Dela via


Kräva godkännande av licens för skript

Licensgodkännande stöds inte för skript. Scenariot där ett skript är beroende av en modul som kräver godkännande av licens stöds dock.

PowerShellGet-skriptkommandona stöder parametern AcceptLicense som beter sig som om användaren såg licensen. Om AcceptLicense inte anges visas filen för den beroende modulen license.txt för användaren och uppmanas att acceptera licensen.

EXEMPEL

Exempel 1: Installera skript med beroenden som kräver godkännande av licensen

Skriptet "ScriptRequireLicenseAcceptance" beror på modulen "ModuleRequireLicenseAcceptance". Användaren uppmanas att acceptera licensen.

PS> Install-Script -Name ScriptRequireLicenseAcceptance

License Acceptance
MIT License 2.0
Copyright (c) 2016 PowerShell Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

Do you accept the license terms for module 'ModuleRequireLicenseAcceptance'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Exempel 2: Installera skript med beroenden som kräver godkännande av licens och -AcceptLicense

Skriptet "ScriptRequireLicenseAcceptance" beror på modulen "ModuleRequireLicenseAcceptance". Användaren uppmanas inte att acceptera licensen eftersom -AcceptLicense har angetts.

PS> Install-Script -Name ScriptRequireLicenseAcceptance -AcceptLicense

Mer information