How to use Package Management with PowerShell 5.0

How to use Package Management with PowerShell 5.0

 

In this blog post, I’ll show you How to use Package Management with PowerShell 5.0 to Install PowerShell modules and packages.

With PowerShell 5.0 there Is no need to download and Install PowerShell modules like the old Office 365 PowerShell module and the Microsoft Azure.

The new package management Is like the Linux apt-get download utility were all packages are listed In a repository and you download the package using a command line.

To achieve the same look and feel Microsoft develops and online repository called PowerShell Gallery where you would find many packages made by Microsoft or by other developers and certified by Microsoft.

The requirements to use the new module are a Windows 10 or Windows Server 2016 which come with PowerShell 5.0 by default and Internet Connection from the machine.

To find a module In the online repository type:

Find-Module Name
How to use Package Management with PowerShell 5.0
How to use Package Management with PowerShell 5.0

To Install a PowerShell module, I’ll use

Install-module posh-docker

To uninstall a module, I’ll use:

Uninstall-module posh-docker

To update existing module, I’ll use

Update-Module

To see all Installed modules on my machine I’ll use

Get-Installedmodule

To view all available cmdlets In the module type:

Get-Command -Module PowerShellGet

Altogether there are 25 cmdlets In the PowerShellGet module listed below:

Find-Command

Find-DscResource

Find-Module

Find-RoleCapability

Find-Script

Get-InstalledModule

Get-InstalledScript

Get-PSRepository

Install-Module

Install-Script

New-ScriptFileInfo

Publish-Module

Publish-Script

Register-PSRepository

Save-Module

Save-Script

Set-PSRepository

Test-ScriptFileInfo

Uninstall-Module

Uninstall-Script

Unregister-PSRepository

Update-Module

Update-ModuleManifest

Update-Script

Update-ScriptFileInfo

To save a PowerShell module without Installing it use:

Save-Module posh-docker

To update existing PowerShell module I use:

Update-Module posh-docker

To uninstall Installed module I use:

Uninstall-module posh-docker

Search








Bitnami