スクリプトでのライセンス同意の必須化

ライセンス同意は、スクリプトではサポートされていません。 ただし、ライセンスへの同意が必要なモジュールにスクリプトが依存するシナリオはサポートされています。

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

詳細