Licentieacceptatie vereisen voor scripts

Acceptatie van licenties wordt niet ondersteund voor scripts. Het scenario waarin een script echter afhankelijk is van een module waarvoor licentieacceptatie is vereist, wordt ondersteund.

De PowerShellGet-scriptopdrachten ondersteunen de parameter AcceptLicense die zich gedraagt alsof de gebruiker de licentie heeft gezien. Als AcceptLicense niet is opgegeven, wordt het bestand voor de license.txt afhankelijke module weergegeven en wordt gevraagd om de licentie te accepteren.

VOORBEELDEN

Voorbeeld 1: Script installeren met afhankelijkheden waarvoor licentieacceptatie is vereist

Script 'ScriptRequireLicenseAcceptance' is afhankelijk van module 'ModuleRequireLicenseAcceptance'. De gebruiker wordt gevraagd licentie te accepteren.

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"):

Voorbeeld 2: Script installeren met afhankelijkheden waarvoor licentieacceptatie en -AcceptLicense is vereist

Script 'ScriptRequireLicenseAcceptance' is afhankelijk van module 'ModuleRequireLicenseAcceptance'. De gebruiker wordt niet gevraagd om een licentie te accepteren omdat -AcceptLicense is opgegeven.

PS> Install-Script -Name ScriptRequireLicenseAcceptance -AcceptLicense

Meer informatie