Prerelease Module in PowerShell 5 installieren

PowerShell Module mit einer Version 0.x, oder solche die sich im Preview Modus befinden, können oft nicht in PowerShell 5 installiert werden. Mit einem Update wird es möglich.

Manche PowerShell Module inkludieren in der PowerShell Gallery den Zusatz AllowPrerelease. Am Beispiel des PnP PowerShell Moduls.

In der Standardinstallation von PowerShell 5 sind diese Prerelease-Module oft nicht installierbar. Bei Install-Module gibt es den Parameter AllowPrerelease nicht. Der Grund ist das vorinstallierte Modul PowerShellGet. PowerShellGet unterstützt erst ab Version 1.6 die Installation von Prerelease Module. Die Aktualisierung von PowerShellGet wird vergessen und so verbleibt das Modul lange Zeit auf Version 1.0.

  • Prüfe welche Version von PowerShellGet installiert ist.
PowerShell
Get-Module PowerShellGet
  • Im Moment ist PowerShellGet 2.x aktuell bzw. Version 3 in Preview.
  • Da PowerShellGet ein Modul ist wird die Aktualisierung, wie bei einem PowerShell Modul üblich, mit Update-Module versucht.
  • Bei PowerShellGet kann es mit Update-Module zu Fehlermeldungen führen. Version 1 von PowerShellGet ist oft bereits vorinstalliert. Dadurch ist eine forcierte Neuinstallation des Moduls erforderlich.
    Wichtig ist nach der Installation nicht zu vergessen das PowerShellGet Modul aus der PowerShell Session zu entfernen und neu zu importieren. Alternativ öffnest du PowerShell einfach neu. Andernfalls wird es die alte Version auflisten.
PowerShell
# For my blog post at https://blog.topedia.com/?p=5328
# Reinstalling the PowerShellGet module in PowerShell 5
Install-Module PowerShellGet -Force

# Unloading the module as the previous version of the module is still loaded
Remove-Module PowerShellGet

# Importing the updated module
Import-Module PowerShellGet

# Verifing the updated PowerShellGet version
Get-Module -Name PowerShellGet
  • Nun wird der Parameter AllowPrerelease in PowerShell 5 verfügbar sein und es damit möglich Module im Prerelease Modus zu installieren.
Share this post:

About the Author

Tobias Asböck

Tobias Asböck

Tobias is a Senior System Engineer with more than 10 years of professional experience with Microsoft 365 products such as SharePoint Online, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print, and Microsoft 365 Licensing. He also has 15+ years of experience planning, administering, and operating SharePoint Server environments. In his spare time, Tobias is busy with updates in the Microsoft 365 world or on the road with his road bike and other sports activities. If you have additional questions, please contact me via LinkedIn or support@topedia.com.

No comments yet