A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/powershell/scripting/gallery/concepts/module-license-acceptance below:

Modules Requiring License Acceptance - PowerShell

SYNOPSIS

Legal departments for some module publishers require that customers must explicitly accept the license before installing their module from PowerShell Gallery. If a user installs, updates, or saves a module using PowerShellGet, whether directly or as a dependency for another package, and that module requires the user to agree to a license, the user must indicate they accept the license or the operation fails.

Publish Requirements for Modules

Modules that would like to require users to accept license should fulfill following requirements:

Impact on Install/Save/Update-Module Module Dependencies Impact on -Force

Specifying –Force is NOT sufficient to accept a license. –AcceptLicense is required for permission to install. If –Force is specified, RequiredLicenseAcceptance is True, and –AcceptLicense is NOT specified, the operation fails.

EXAMPLES Example 1: Update Module Manifest to require license acceptance
Update-ModuleManifest -Path C:\modulemanifest.psd1 -RequireLicenseAcceptance -PrivateData @{
    PSData = @{
        # Flag to indicate whether the module requires explicit user acceptance
        RequireLicenseAcceptance = $true
    } # End of PSData hashtable

 } # End of PrivateData hashtable

This command updates the manifest file and sets the RequireLicenseAcceptance flag to true.

Example 2: Install Module requiring license acceptance
Install-Module -Name ModuleRequireLicenseAcceptance
License Acceptance

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

This command shows the license from license.txt file and prompts the user to accept the license.

Example 3: Install Module requiring license acceptance with -AcceptLicense
Install-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

Module is installed without any prompt to accept license.

Example 4: Install Module requiring license acceptance with -Force
Install-Module -Name ModuleRequireLicenseAcceptance -Force
PackageManagement\Install-Package : License Acceptance is required for module 'ModuleRequireLicenseAcceptance'. Please specify '-AcceptLicense' to perform this operation.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.1.3.3\PSModule.psm1:1837 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
   xception
    + FullyQualifiedErrorId : ForceAcceptLicense,Install-PackageUtility,Microsoft.PowerShell.PackageManagement.Cmdlets
   .InstallPackage
Example 5: Install Module with dependencies requiring license acceptance

Module ModuleWithDependency depends on module ModuleRequireLicenseAcceptance. User is prompted to accept license.

Install-Module -Name ModuleWithDependency
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"):
Example 6: Install Module with dependencies requiring license acceptance and -AcceptLicense

Module ModuleWithDependency depends on module ModuleRequireLicenseAcceptance. User is not prompted to accept license as AcceptLicense is specified.

Install-Module -Name ModuleWithDependency -AcceptLicense
Example 7: Install module requiring license acceptance on a client older than PSGetFormatVersion 2.0
Install-Module -Name ModuleRequireLicenseAcceptance
WARNING: The specified module 'ModuleRequireLicenseAcceptance' with PowerShellGetFormatVersion
'2.0' is not supported by the current version of PowerShellGet. Get the latest version of the
PowerShellGet module to install this module, 'ModuleRequireLicenseAcceptance'.
Example 8: Save Module requiring license acceptance
Save-Module -Name ModuleRequireLicenseAcceptance -Path C:\Saved
License Acceptance

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

This command shows the license from license.txt file and prompts the user to accept the license.

Example 9: Save Module requiring license acceptance with -AcceptLicense
Save-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense -Path C:\Saved

Module is saved without any prompt to accept license.

Example 10: Update Module requiring license acceptance
Update-Module -Name ModuleRequireLicenseAcceptance
License Acceptance

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

This command shows the license from license.txt file and prompts the user to accept the license.

Example 11: Update Module requiring license acceptance with -AcceptLicense
Update-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

Module is updated without any prompt to accept license.

More details

Require License Acceptance for Scripts

Require License Acceptance support on PowerShellGallery

Require License Acceptance on Deploy to Azure Automation


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4