Skip to content
Jianyun edited this page Aug 11, 2016 · 8 revisions

OneGet in action

PS C:\> Import-Module PackageManagement
PS C:\> Get-Command -Module PackageManagement
 
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Find-Package                                       1.0.0.1    PackageManagement
Cmdlet          Find-PackageProvider                               1.0.0.1    PackageManagement
Cmdlet          Get-Package                                        1.0.0.1    PackageManagement
Cmdlet          Get-PackageProvider                                1.0.0.1    PackageManagement
Cmdlet          Get-PackageSource                                  1.0.0.1    PackageManagement
Cmdlet          Import-PackageProvider                             1.0.0.1    PackageManagement
Cmdlet          Install-Package                                    1.0.0.1    PackageManagement
Cmdlet          Install-PackageProvider                            1.0.0.1    PackageManagement
Cmdlet          Register-PackageSource                             1.0.0.1    PackageManagement
Cmdlet          Save-Package                                       1.0.0.1    PackageManagement
Cmdlet          Set-PackageSource                                  1.0.0.1    PackageManagement
Cmdlet          Uninstall-Package                                  1.0.0.1    PackageManagement
Cmdlet          Unregister-PackageSource                           1.0.0.1    PackageManagement

Also see more references:

Get a list of package providers on your machine

PS C:\> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.202        Destination, ExcludeVersion, Headers, FilterOnTag, Contains...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, InstallUpdate...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode...

Get a list of registered package sources

PS C:\> Get-PackageSource -Provider chocolatey

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
chocolatey                       Chocolatey       False      http://www.chocolatey.org/api/v2/
PSGallery                        PowerShellGet    False      https://www.powershellgallery.com/api/v2/
nuget.org                        Nuget            False      https://www.nuget.org/api/v2/

Discover some packages

PS C:\> Find-Package -ProviderName PowerShellget

Name                           Version          Source           Summary
----                           -------          ------           -------
AzureRM.profile                1.0.4            PSGallery        Microsoft Azure PowerShell - Profile credential man...
Azure.Storage                  1.0.4            PSGallery        Microsoft Azure PowerShell - Storage service cmdlet...
AzureRM                        1.2.0            PSGallery        Azure Resource Manager Module
Posh-SSH                       1.7.3            PSGallery        Provide SSH functionality for executing commands ag...
AzureRM.Automation             1.0.4            PSGallery        Microsoft Azure PowerShell - Automation service cmd...
AzureRM.ApiManagement          1.0.4            PSGallery        Microsoft Azure PowerShell - Api Management service...
AzureRM.Resources              1.0.4            PSGallery        Microsoft Azure PowerShell - Azure Resource Manager...
AzureRM.Compute                1.2.2            PSGallery        Microsoft Azure PowerShell - Compute service cmdlet...
AzureRM.HDInsight              1.0.5            PSGallery        Microsoft Azure PowerShell - HDInsight service cmdl...
AzureRM.Backup                 1.0.4            PSGallery        Microsoft Azure PowerShell - Azure Backup service c...
AzureRM.Network                1.0.4            PSGallery        Microsoft Azure PowerShell - Network service cmdlet...

PS C:\> Find-Package -Name zoomit -AllVersions
 
Name         Version     Status      Source         Summary                                                    
----         -------     ------      ------         -------                                                     
zoomit       4.42        Available   chocolatey     ZoomIt is a screen zoom and... 
zoomit       4.5         Available   chocolatey     ZoomIt is a screen zoom and... 
zoomit       4.50        Available   chocolatey     ZoomIt is a screen zoom and...

Install a package

PS C:\> Install-Package -Name zoomit
 
Name           Version     Status      Source        Summary                       
----           -------     ------      ------         -------                      
zoomit         4.50        Installed   chocolatey     ZoomIt is ascreen zoom and...

Show what packages are installed

PS C:\> Get-Package
 
Name           Version     Status       Source        Summary                                                    
----           -------     ------       ------         -------                                                    
cyg-get        1.1.1       Installed    Local File     A utility to install Cygwin...
zoomit         4.50        Installed    Local File     ZoomIt is ascreen zoom and...

Save a package to local folder

PS C:\> Save-Package -Name jquery -Source https://www.nuget.org/api/v2/ -Path c:\test

Register package repositories

PS C:\> Register-PackageSource -Name local -ProviderName Nuget -Location \\MyShare\scratch\LocalRepository\

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
local                            NuGet            False      \\MyShare\scratch\LocalRepository\


PS C:\> Register-PackageSource -Name PSGet -ProviderName PowerShellGet -Location "https://www.powershellgallery.com/api/v2"
Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
PSGet                            PowerShellGet    False      https://www.powershellgallery.com/api/v2/

PS C:\WINDOWS\system32> find-module -Repository PSGet

Version    Name                                Type       Repository       Description
-------    ----                                ----       ----------       -----------
1.0.4      AzureRM.profile                     Module     PSGet            Microsoft Azure PowerShell - Profile ...
1.0.4      Azure.Storage                       Module     PSGet            Microsoft Azure PowerShell - Storage ...
1.2.0      AzureRM                             Module     PSGet            Azure Resource Manager Module
1.7.3      Posh-SSH                            Module     PSGet            Provide SSH functionality for executi...
1.0.4      AzureRM.Automation                  Module     PSGet            Microsoft Azure PowerShell - Automati...
1.0.4      AzureRM.ApiManagement               Module     PSGet            Microsoft Azure PowerShell - Api Mana...
1.0.4      AzureRM.Resources                   Module     PSGet            Microsoft Azure PowerShell - Azure Re...
1.2.2      AzureRM.Compute                     Module     PSGet            Microsoft Azure PowerShell - Compute ...
1.0.5      AzureRM.HDInsight                   Module     PSGet            Microsoft Azure PowerShell - HDInsigh...