Getting started with PackageManagement cmdlets

First we need to know the cmdlets associated with package management feature in the PowerShell. To get the cmdlets, we can use get-command:

Get-Command -Module packagemanagement
Cmdlets available for packagemanagement module
Cmdlets available for packagemanagement module

We can see the list of package sources, which comes out of the box for us. For this we can use command:

Get-PackageSource
Package sources available
Package sources available

To get list of software packages installed on local machine, use cmdlet Get-Package. To see list of package providers available for packagemanagement, use cmdlet Get-PackageProvider:

List of package providers available
List of package providers available

Other than above providers, chocolatey (https://chocolatey.org/) is one other major provider. Now let’s say we need to register chocolatey as a provider. For this we can use below command:

Register-PackageSource -Name chocolatey `
 -Location http://chocolatey.org/api/v2 `
 -Provider PSModule `
 -Trusted `
 -Verbose

To find matching software packages that are available for all package sources, use cmdlet find-package:

Example for find-package cmdlet
Example for find-package cmdlet

Fun thing, if you have chocolatey as provider, you can download and install softwares like google chrome, vlc, firefox, java, adobe reader, winrar and hundreds more.

You can head over to https://chocolatey.org/packages to see list of available package at your disposal. Gone are the days when people used IE to install other browsers. Now we IT Pro can do the same and more using PowerShell. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s