需要为脚本接受许可证

脚本不支持接受许可证。 但是,支持其中的脚本依赖于需要接受许可证的模块的方案。

PowerShellGet 脚本命令将支持参数 AcceptLicense,此参数的行为就好像用户看到了许可证。 如果未指定 AcceptLicense,系统将向用户显示依赖模块的 license.txt 文件,并提示用户接受许可证。

示例

示例 1:安装脚本及需要接受许可证的依赖项

脚本“ScriptRequireLicenseAcceptance”依赖于“ModuleRequireLicenseAcceptance”模块。 系统提示用户接受许可证。

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

示例 2:安装脚本及需要接受许可证和 -AcceptLicense 的依赖项

脚本“ScriptRequireLicenseAcceptance”依赖于“ModuleRequireLicenseAcceptance”模块。 系统不提示用户接受许可证,因为已指定 -AcceptLicense。

PS> Install-Script -Name ScriptRequireLicenseAcceptance -AcceptLicense

更多详细信息