HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 3 Modules

In the last installment of this Windows PowerShell HELP series, you learnt about the new cmdlets introduced in both PS 5.0 and 5.1. But where do they actually come from?

A module is essentially a data repository which groups all relevant cmdlets, functions and commands under one roof. Since PS 3.0, the mere act of running a cmdlet will cause Windows PowerShell to load the corresponding module without administrative intervention. To make this work, modules must be placed in a location listed in $env:PSModulepath. Because of this automatic module loading feature, an administrator does not always need to know exactly in which module a particular command resides[1]. By changing the $PSModuleAutoLoadingPreference preference variable, you can enable, disable and configure automatic importing of modules.

For a default Windows Server 2012 R2 (PS 4.0) installation, a total of 63 modules are available for use. The addition …

… of 5 (PS 5.0) and 6 (PS 5.1) new modules export primarily the extra cmdlets discussed previously. In a standard Windows Server 2016 RTM (en-us) install, this figure is 83.

Do pay attention to the fact that it is indeed possible to have different versions of a module with the same name installed in the same or different path.

PS 5.0

PS 5.1

PackageManagement

PackageManagement

PowerShellGet

PowerShellGet

Microsoft.PowerShell.Archive

Microsoft.PowerShell.Archive

Microsoft.PowerShell.LocalAccounts

Microsoft.PowerShell.ODataUtils

Microsoft.PowerShell.ODataUtils

NetworkSwitchManager

NetworkSwitchManager

Note that the PackageManagement module started with the name OneGet in PowerShell 5.0 Preview (in Windows 10 Preview). This is a generic package manager (comparable to apt-get in the Linux world) and should not be confused with PowerShellGet. PowerShellGet is a module which makes commands available for the purpose of discovering, installing, updating and publishing PowerShell artifacts from Modules, DSC resources, Role capabilities to Scripts.

You can find PackageManagement in Windows Server 2016 and Windows 10 RTM and later releases, and it is available for earlier OS versions by installing Windows Management Framework 5.1.

[1]
gcm -commandType cmdlet | ? name -eq get-service;
gcm -commandType function | ? name -eq get-disk

REFERENCES

– PowerShellGet (PowerShell Gallery)
– PackageManagement (aka OneGet on GitHub)
– PowerShell GitHub Community (link)
– PackageManagement Support on Nano Server (Nano Server Blog)
– PowerShellGet and PackageManagement in PowerShell Gallery and GitHub (Windows PowerShell Blog)
– Package Management Preview – March 2016 for PowerShell 4 & 3 is now available (Windows PowerShell Blog)

Leave a Reply