PowerShell Commands

Find-Package

Find-Package [[-Name] <String[]>] [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile <String>] [-Contains<String>] [-Credential <PSCredential>] [-FilterOnTag <String[]>] [-Force] [-ForceBootstrap] [-Headers <String[]>][-IncludeDependencies] [-MaximumVersion <String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu |Programs | PowerShellGet | psl | chocolatey}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-RequiredVersion<String>] [-SkipValidate] [-Source <String[]>] [<CommonParameters>]
Find-Package [[-Name] <String[]>] [-AllVersions] [-Command <String[]>] [-Credential <PSCredential>] [-DscResource<String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-IncludeDependencies] [-Includes {DscResource | Cmdlet| Function | Workflow | RoleCapability}] [-MaximumVersion <String>] [-MinimumVersion <String>][-PackageManagementProvider <String>] [-ProviderName {msi | NuGet | msu | Programs | PowerShellGet | psl |chocolatey}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RequiredVersion<String>] [-RoleCapability <String[]>] [-ScriptPublishLocation <String>] [-ScriptSourceLocation <String>] [-Source<String[]>] [-Tag <String[]>] [-Type {Module | Script | All}] [<CommonParameters>]

The Find-Package cmdlet finds matching software packages that are available in package sources.

Parameters

-AllVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

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

-AllowPrereleaseVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill AllowPrereleaseVersions Description}}

-Command <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies an array of commands for which this cmdlet searches.

-ConfigFile <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill ConfigFile Description}}

-Contains <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill Contains Description}}

-Credential <PSCredential>

  • Default value is None
  • Accepts pipeline input False

Specifies a user account that has permission to search for packages.

-DscResource <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies an array of Desired State Configuration (DSC) resources for which this cmdlet searches.

-Filter <String>

  • Default value is None
  • Accepts pipeline input False

Specifies terms to search for within the Name and Description properties.

-FilterOnTag <String[]>

  • Default value is None
  • Accepts pipeline input False

{{Fill FilterOnTag 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.

-Headers <String[]>

  • Default value is None
  • Accepts pipeline input False

{{Fill Headers Description}}

-IncludeDependencies [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet includes package dependencies in the results.

-Includes <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies whether Find-Package should find all packages with DSC resources, cmdlets, functions, or workflows. The acceptable values for this parameter are:

- Cmdlet

- DscResource

- Function

- Workflow

-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, Find-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.

-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.

-Proxy <Uri>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-ProxyCredential <PSCredential>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-PublishLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies a location for publishing the package.

-RequiredVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the exact allowed 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.

-RoleCapability <String[]>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-ScriptPublishLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies a script publishing location for the package.

-ScriptSourceLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies a script source location.

-SkipValidate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill SkipValidate Description}}

-Source <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies one or more package sources. You can get a list of available package sources by using the Get-PackageSource cmdlet.

-Tag <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more strings to search for in the package metadata.

-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.

Inputs
You cannot pipe input to this cmdlet
Outputs
SoftwareIdentify[]
This cmdlet does not produce any output.
Examples
  1. Find all available packages from a package provider:
    PS C:\> Find-Package -Provider "PSModule"
    

    This command finds all available Windows PowerShell module packages from galleries that are registered with the PSModule provider.

  2. Find a package from a provider that is not yet installed:
    PS C:\> Find-Package -Name "Git" -Provider "Chocolatey"
    

    This command first automatically installs the Chocolatey provider on the local computer, then searches for the Git package within that provider.

  3. Find a package from a package source:
    PS C:\> Find-Package -Name "Git" -Source "ChocolateyRepository"
    

    This command finds a package from a specified package source. This is a useful command if you know the name of the package source that you want to search, but are unsure about the package provider to which the source is registered. Without specifying a package source, Find-Package searches through all installed package providers and their package sources for a specified package. You can run Get-PackageSource -Location to get a package source name.

  4. Find a package from a file system:
    PS C:\> Find-Package "C:\temp"
    

    This command finds packages from all installed PackageManagement package providers that are stored in the C:\temp folder on the local computer.

  5. Find a package with a specific name and version:
    PS C:\> Find-Package -Name "DSCAccel" -RequiredVersion "2.1.2"
    

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

  6. Find packages within a range of versions:
    PS C:\> Find-Package -Name "DSCAccelerator" -MinimumVersion "1.5.0" -MaximumVersion "2.1" -AllVersions
    

    This command finds a matching range of versions of a package named DSCAccelerator, by adding the MinimumVersion and MaximumVersion parameters to specify a range, and the AllVersions parameter to specify that all matching results within that range are returned as results.

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