For the ones who do not know yet, PowerShell oneGet is a tool that will allow you to manage, your applications on a machine using Powershell.
If you are familiar to Linux apt-get then you you will feel like home reading this blog post.
PowerShell oneGet is only available in Powershell version 5.0
How can I find the powershell version I am using?
There is nothing easier to do in your prompt, use the $PsVErsionTable command to see what powershell version you have installed.
1
|
$PsVersionTable
|
You will have a smiliar return as in the screen shot below. Be sure that psVersion value is at least 5.0.x
If you are missing the powershell 5.0, you can get it right here. Be sure to run a Update-Help to get the latest help files with it.
Let’s see the possibilities that we have :
1
|
get-command -module OneGet
|
What does each cmdlet actually stands for?
If you haven’t updated your help since the installation of PowerShell 5.0, now is the moment to do it, otherwise the following trick won’t work.
Get the latest help files using the following cmdlet:
1
|
update-help
|
We have our list of cmdlets now, and the help is updated, but how can I have a short information, a one line description of each cmdlet? (Even though the PowerShell naming convention is pretty straight forward).
1
|
get-command -Module oneget | % {get-help $_.Name | select name,synopsis} | Format-Table -AutoSize
|
like this:
The following cmdlets are available:
Name | Synopsis |
Find-Package | Finds software packages in available package sources. |
Get-Package | Returns a list of all software packages that have been installed by using OneGet. |
Get-PackageProvider | Returns a list of package providers that are connected to OneGet. |
Get-PackageSource | Gets a list of package sources that are registered for a package provider. |
Install-Package | Installs one or more software packages. |
Register-PackageSource | Adds a package source for a specified package provider. |
Save-Package | Saves packages to the local computer without installing them. |
Set-PackageSource | Replaces a package source for a specified package provider. |
Uninstall-Package | Uninstalls one or more software packages. |
Unregister-PackageSource | Removes a registered package source. |
Using Find-package will allow you to retrieve all available packages on your current repository.
Why do I see so few packages ?
When I first used PowerShell oneGet, I only had 103 packages returned.
I knew this number was incorrect, since I read on various places on the internet that the number of packages was (at least) bigger then 1000+.
Let’s digg more into this!
The following two cmdlets will let you manage you OneGet provider and sources.
- Get-PackageProvider
- Get-PackageSource
When we launch them, this is what got returned.
I knew for sure that Chocaltey was suppose to be in the list. I know that most of the available packages are currently located on the Chocolatey repository.
How to add a oneget package source using powershell?
I added the Chocolatey packageSource using the following command line.
1
|
Register-PackageSource -Name chocolatey -Location http://chocolatey.org/api/v2 -Provider PSModule -Trusted -Verbose
|
And if I launch the Find-Package cmdlet now…
“Actually, it has 2805 today (April 12th 2015).”
How to install an application using powershell?
In order to install an application / package with powershell, we simple use the following command:
1
|
install-Package <PAckageName>
|
In the example below, I added the verbose switch to show that the package actually comes from the Chocolatey repository.
There you go. Drop a comment if you liked, and don’t forget to read more about it in the resources section 🙂
Resources :
Online OneGet help page –> http://docs.nuget.org/docs/Reference/Package-Manager-Console-PowerShell-Reference
Very good article from my friend and “compatriote Français” FX, the lazy WinAdmin (who is actually not THAT lazy I have to say) –> http://www.lazywinadmin.com/2014/04/powershell-playing-with-new-oneget.html
A good article written by the scripting games winner and PowerShell MVP Mike F Robbins –> http://mikefrobbins.com/2014/04/07/installing-software-with-the-oneget-module-in-powershell-version-5/
http://www.fixedbyvonnie.com/2014/11/5-minute-setup-using-oneget-chocolatey-windows-10/#.VFxwx_mG8a0
Leave A Comment