Get-Package
Syntax
Get-Package
[[-Name] <String[]>]
[-RequiredVersion <String>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-Force]
[-ForceBootstrap]
[-ProviderName <String[]>]
[-IncludeWindowsInstaller]
[-IncludeSystemComponent]
[<CommonParameters>]
Get-Package
[[-Name] <String[]>]
[-RequiredVersion <String>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-Force]
[-ForceBootstrap]
[-ProviderName <String[]>]
[-AdditionalArguments <String[]>]
[<CommonParameters>]
Get-Package
[[-Name] <String[]>]
[-RequiredVersion <String>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-Force]
[-ForceBootstrap]
[-ProviderName <String[]>]
[-Destination <String>]
[-ExcludeVersion]
[-Scope <String>]
[<CommonParameters>]
Get-Package
[[-Name] <String[]>]
[-RequiredVersion <String>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-Force]
[-ForceBootstrap]
[-ProviderName <String[]>]
[-Scope <String>]
[-PackageManagementProvider <String>]
[-Type <String>]
[-AllowClobber]
[-SkipPublisherCheck]
[-InstallUpdate]
[-NoPathUpdate]
[<CommonParameters>]
Description
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.
Examples
Example 1: Get all installed packages
PS C:\> Get-Package
This command gets all packages that are installed on the local computer.
Example 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.
Example 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.
Example 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.
Example 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.
Optional Parameters
Specifies additional arguments.
Type: | String[] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that Get-Package returns all available versions of the package. By default, Get-Package only returns the newest available version.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
{{Fill Destination Description}}
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
{{Fill ExcludeVersion Description}}
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Forces the command to run without asking for user confirmation.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet forces Package Management to automatically install the package provider.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet includes system components in the results.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet includes the Windows Installer in the results.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet installs updates.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies one or more package names, or package names with wildcard characters. Separate multiple package names with commas.
Type: | String[] |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the name of the Package Management provider.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies one or more package provider names. Separate multiple package provider names with commas.
Type: | String[] |
Aliases: | Provider |
Parameter Sets: | Programs, msi, msu, PowerShellGet, nuget, chocolatey |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the search scope for the package.
Type: | String |
Parameter Sets: | CurrentUser, AllUsers |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies whether to search for packages with a module, a script, or either.
Type: | String |
Parameter Sets: | Module, Script, All |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Outputs
SoftwareIdentity[]