48. Package management


The below information is extensively based in information taken from the PowerShell® Notes for Professionals book. I plan to extend this information based on my day to day usage of the language.

PowerShell Package Management allows you to find, install, update and uninstall PowerShell Modules and other packages.

PowerShellGallery.com is the default source for PowerShell modules. You can also browse the site for available packages, command and preview the code.

48.1: Create the default PowerShell Module Repository

If for some reason, the default PowerShell module repository PSGallery gets removed. You will need to create it.

This is the command.

Register-PSRepository -Default

48.2: Find a module by name

Find-Module -Name <Name>

48.3: Install a Module by name

Install-Module -Name <name>

48.4: Uninstall a module my name and version

Uninstall-Module -Name <Name> - RequiredVersion <Version>

48.5: Update a module by name

Update-Module -Name <Name>

48.6: Find a PowerShell module using a pattern

To find a module that ends with DSC

Find-Module -Name *DSC