PowerShell Commands

Get-Package

Get-Package [[-Name] <String[]>] [-AdditionalArguments <String[]>] [-AllVersions] [-Force] [-ForceBootstrap][-MaximumVersion <String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu | Programs | PowerShellGet| psl | chocolatey}] [-RequiredVersion <String>] [<CommonParameters>]
Get-Package [[-Name] <String[]>] [-AllVersions] [-AllowClobber] [-Force] [-ForceBootstrap] [-InstallUpdate][-MaximumVersion <String>] [-MinimumVersion <String>] [-NoPathUpdate] [-PackageManagementProvider <String>][-ProviderName {msi | NuGet | msu | Programs | PowerShellGet | psl | chocolatey}] [-RequiredVersion <String>][-Scope {CurrentUser | AllUsers}] [-SkipPublisherCheck] [-Type {Module | Script | All}] [<CommonParameters>]
Get-Package [[-Name] <String[]>] [-AllVersions] [-Destination <String>] [-ExcludeVersion] [-Force][-ForceBootstrap] [-MaximumVersion <String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu |Programs | PowerShellGet | psl | chocolatey}] [-RequiredVersion <String>] [-Scope {CurrentUser | AllUsers}][-SkipDependencies] [<CommonParameters>]
Get-Package [[-Name] <String[]>] [-AllVersions] [-Force] [-ForceBootstrap] [-IncludeSystemComponent][-IncludeWindowsInstaller] [-MaximumVersion <String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu| Programs | PowerShellGet | psl | chocolatey}] [-RequiredVersion <String>] [<CommonParameters>]

The Get-Package cmdlet returns a list of all software packages on the local computer that have been installed by using Package Management. You can run Get-Package on remote computers by running it as part of an Invoke-Command or Enter-PSSession command or script.

Parameters

-AdditionalArguments <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies additional arguments.

-AllVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that Get-Package returns all available versions of the package. By default, Get-Package only returns the newest available version.

-AllowClobber [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-Destination <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill Destination Description}}

-ExcludeVersion [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill ExcludeVersion Description}}

-Force [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Forces the command to run without asking for user confirmation.

-ForceBootstrap [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet forces Package Management to automatically install the package provider.

-IncludeSystemComponent [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet includes system components in the results.

-IncludeWindowsInstaller [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet includes the Windows Installer in the results.

-InstallUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet installs updates.

-MaximumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the maximum allowed version of the package that you want to find. If you do not add this parameter, Get-Package finds the highest available version of the package.

-MinimumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the minimum allowed version of the package that you want to find. If you do not add this parameter, Find-Package finds the highest available version of the package that also satisfies any maximum specified version specified by the MaximumVersion parameter.

-Name <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more package names, or package names with wildcard characters. Separate multiple package names with commas.

-NoPathUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-PackageManagementProvider <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the name of the Package Management provider.

-ProviderName <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies one or more package provider names. Separate multiple package provider names with commas.

-RequiredVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the exact version of the package to find. If you do not add this parameter, Find-Package finds the highest available version of the provider that also satisfies any maximum version specified by the MaximumVersion parameter.

-Scope <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the search scope for the package.

-SkipDependencies [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill SkipDependencies Description}}

-SkipPublisherCheck [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-Type <String>

  • Default value is None
  • Accepts pipeline input False

Specifies whether to search for packages with a module, a script, or either.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Outputs
SoftwareIdentity[]
Examples
  1. Get all installed packages:
    PS C:\> Get-Package
    

    This command gets all packages that are installed on the local computer.

  2. Get packages that are installed on a remote computer:
    PS C:\> Invoke-Command -ComputerName "server01" -Credential "CONTOSO\TestUser" -ScriptBlock {Get-Package}
    

    This command gets a list of packages that were installed on a remote computer, server01, by using Package Management. When you run this command, you are prompted to provide credentials for the user CONTOSO\TestUser.

  3. Get packages for a specified provider:
    PS C:\> Get-Package -Provider "ARP"
    

    This command gets Add or Remove Programs software packages from the local computer.

  4. Get an exact version of a specific package:
    PS C:\> Get-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2"
    

    This command gets version 2.1.2 of a package named DSCAccelerator. Although only part of the package name has been specified, Get-Package should be able to find the DSCAccelerator package if there are no other packages with a name matching that pattern.

  5. Uninstall a package:
    PS C:\> Get-Package -Name "DSCAccelerator" -RequiredVersion "2.1" | Uninstall-Package
    

    This command pipes the results of a Get-Package command to the Uninstall-Package cmdlet. In this example, you are uninstalling only version 2.1 of the DSCAccelerator package. You are prompted to confirm that you want to uninstall the package.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands