Lisans Kabulü Gerektiren Modüller

ÖZET

Bazı modül yayımcılarının hukuk departmanları, müşterilerin PowerShell Galerisi modüllerini yüklemeden önce lisansı açıkça kabul etmelerini gerektirir. Bir kullanıcı doğrudan veya başka bir paket için bağımlılık olarak PowerShellGet kullanarak bir modülü yükler, güncelleştirir veya kaydederse ve bu modül kullanıcının bir lisansı kabul etmesi gerekiyorsa, kullanıcının lisansı kabul ettiğini belirtmesi gerekir; aksi takdirde işlem başarısız olur.

Modüller için Yayımlama Gereksinimleri

Kullanıcıların lisans kabul etmelerini gerektiren modüller aşağıdaki gereksinimleri karşılamalıdır:

  • Modül bildiriminin PSData bölümü RequireLicenseAcceptance = $True içermelidir.
  • Modül, kök dizinde license.txt dosya içermelidir.
  • Modül bildirimi Lisans Uri'si içermelidir.
  • Modül PowerShellGet Biçim Sürüm 2.0 ve üzeri ile yayımlanmalıdır.

Yükleme/Kaydetme/Güncelleştirme Modülü Üzerindeki Etkisi

  • Yükleme/Kaydetme/Güncelleştirme cmdlet'leri, kullanıcı lisansı görmüş gibi davranan yeni bir AcceptLicense parametresini destekler.
  • RequiredLicenseAcceptance True ise ve AcceptLicense belirtilmezse, kullanıcıya gösterilir license.txtve şununla istenir: Do you accept these license terms (Yes/No/YesToAll/NoToAll).
    • Lisans kabul edilirse
      • Save-Module: modül kullanıcının sistemine kopyalanır
      • Install-Module: modül kullanıcının sistemine doğru klasöre kopyalanır (kapsama göre)
      • Güncelleştirme Modülü: modül güncelleştirilir.
    • Lisans reddedilirse.
      • İşlem iptal edildi.
      • Tüm cmdlet'ler, lisans kabulü gerektiğini belirten meta verileri (requireLicenseAcceptance ve Format Version) denetler
      • İstemcinin biçim sürümü 2.0'dan eskiyse, işlem başarısız olur ve kullanıcıdan istemciyi güncelleştirmesini ister.
      • Modül 2.0'dan eski bir biçim sürümüyle yayımlandıysa requireLicenseAcceptance bayrağı yoksayılır.

Modül Bağımlılıkları

  • Yükleme/Kaydetme/Güncelleştirme işlemi sırasında, bağımlı bir modül (modüle bağlı başka bir şey) lisans kabulü gerektiriyorsa, lisans kabul davranışı (yukarıda) gereklidir.
  • Modül sürümü sistemde yüklü olarak yerel katalogda zaten listeleniyorsa lisans denetimini atlarız.
  • Yükleme/Kaydetme/Güncelleştirme işlemi sırasında, bağımlı bir modül lisans gerektiriyorsa ve lisans kabulü gerçekleşmiyorsa, işlem başarısız olur ve paketin yüklenemediği/kaydedilemediği/güncelleştirilemediği normal işlemleri izler.

-Force üzerindeki etkisi

–Force Belirtmek, bir lisansı kabul etmek için yeterli DEĞILDIR. –AcceptLicense yükleme izni için gereklidir. Belirtilirse –Force , RequiredLicenseAcceptance True olur ve –AcceptLicense NOT belirtilirse işlem başarısız olur.

ÖRNEKLER

Örnek 1: Modül Bildirimini lisans kabulü gerektirecek şekilde güncelleştirme

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

Bu komut bildirim dosyasını güncelleştirir ve RequireLicenseAcceptance bayrağını true olarak ayarlar.

Örnek 2: Lisans kabulü gerektiren Modülü yükleme

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

Bu komut dosyadaki lisansı gösterir ve kullanıcıdan license.txt lisansı kabul etmelerini ister.

Örnek 3: -AcceptLicense ile lisans kabulü gerektiren Modülü yükleme

Install-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

Modül, lisans kabul etmek için herhangi bir istem olmadan yüklenir.

Örnek 4: -Force ile lisans kabulü gerektiren Modülü yükleme

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

Örnek 5: Lisans kabulü gerektiren bağımlılıklarla Modül yükleme

ModuleWithDependency modülü ModuleRequireLicenseAcceptance modülüne bağlıdır. Kullanıcıdan lisansı kabul etmek isteyip istemediğiniz sorulur.

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

Örnek 6: Lisans kabulü ve -AcceptLicense gerektiren bağımlılıklarla Modül yükleme

ModuleWithDependency modülü ModuleRequireLicenseAcceptance modülüne bağlıdır. AcceptLicense belirtildiğinden kullanıcıdan lisansı kabul etmemesi istenmez.

Install-Module -Name ModuleWithDependency -AcceptLicense

Örnek 7: PSGetFormatVersion 2.0'dan daha eski bir istemciye lisans kabulü gerektiren modülü yükleme

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'.

Örnek 8: Lisans kabulü gerektiren Modülü Kaydetme

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

Bu komut dosyadaki lisansı gösterir ve kullanıcıdan license.txt lisansı kabul etmelerini ister.

Örnek 9: -AcceptLicense ile lisans kabulü gerektiren Modülü kaydetme

Save-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense -Path C:\Saved

Modül, lisans kabul etmek için herhangi bir istem olmadan kaydedilir.

Örnek 10: Lisans kabulü gerektiren Modülü Güncelleştirme

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

Bu komut dosyadaki lisansı gösterir ve kullanıcıdan license.txt lisansı kabul etmelerini ister.

Örnek 11: -AcceptLicense ile lisans kabulü gerektiren Güncelleştirme Modülü

Update-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

Modül, lisans kabul etmek için herhangi bir istem olmadan güncelleştirilir.

Daha fazla ayrıntı’yı seçin

Betikler için Lisans Kabulü Gerektir

PowerShellGallery'de Lisans Kabulü desteği gerektir

Azure Otomasyonuna Dağıtmada Lisans Kabulü Gerektir