What’s new in PowerShell 5.0 – OneGet?
I’ve been researching the new features of PowerShell 5.0, and I love the OneGet module. It provides a set of cmdlets which allow you to quickly and easily manage the applications installed on your systems. You can run Get-Command –Module OneGet to see the list of available cmdlets in this module:
There are package provider repositories available from sources around the internet. To see which repos you can access by default, run the Get-PackageSource cmdlet to see a list:
There is a web provider and package management application suite called Chocolatey, which the initial version of OneGet was based on. I’ll write about Chocolatey in my next post.
But let’s step through installing an application using the OneGet module cmdlets. I’ve decided I want to install the HardwareManagement app, so I first run the Find-Package cmdlet:
I see that the package is available and will be downloaded from the mcsonfiggallery repo and I want to install it. Best practice is to run the Find-Package cmdlet and pipe the output to the Install-Package cmdlet to avoid having to manually enter many identifying arguments. I use the –Verbose option on Install-Package which displays the yellow detailed text indicating exactly what’s happening during the install:
If the source repository for your package download isn’t trusted, you will be asked to confirm that you want to continue with the download. If you are confident that you trust your repository, you can add trust by running the Set-PackageSource cmdlet:
Now when I install another package, Posh-SSH, I do not get the “not trusted” prompt:
To see the applications installed, check the Program Files folder:
As you get comfortable, you can see how using these package management commands can boost productivity when rolling software out to multiple servers.
Next time we’ll explore the Chocolatey commands and repositories.