31 December 2014

PowerShell 5.0 and the OneGet commandlets

Great new feature coming up in WMF 5.0: OneGet.
Most people are familiar with the package managers within the different Linux tastes.

Well OneGet is just like that but then for Windows.
Command line based software installation and un-installation.
It works with the Chocolatey as the software repository which currently holds up 2561 applications.

There are 2 more repository's, PSGallery and MSPSGallery but they hold none to little applications.

First let's see what we can do with OneGet:

Get-Command -Module OneGet | Select Name

Name
----
Find-Package
Get-Package
Get-PackageProvider
Get-PackageSource
Install-Package
Register-PackageSource
Save-Package
Set-PackageSource
Uninstall-Package
Unregister-PackageSource

If you want to start using OneGet, you first have to install "nuget":

Find-Package

The provider 'nuget v2.8.3.6' is not installed.
'nuget' may be manually downloaded from
'https://oneget.org/nuget-anycpu-2.8.3.6.exe' and copied to 'C:\Program
Files\OneGet\ProviderAssemblies'.
Would you like OneGet to automatically download and install 'nuget' now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

To view the installed repositories:
Get-PackageSource
To view the total number of packages in the repository:
Find-Package | Measure-Object
To show all the packages in the repository:
Find-Package | Sort-Object –Property Name | Out-GridView
Install a package:
install-package -Name imgburn
To uninstall a package:
uninstall-package -Name imgburn
Set the repository as trusted:
set-packagesource -name chocolatey -trusted
To unregister the Chocolatey repository:
Unregister-PackageSource –name Chocolatey

Source

No comments:

Post a Comment