Find-PSResource

Searches for packages from a repository (local or remote), based on a name or other package properties.

Syntax

Find-PSResource
    [[-Name] <String[]>]
    [-Type <ResourceType>]
    [-Version <String>]
    [-Prerelease]
    [-Tag <String[]>]
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-IncludeDependencies]
    [<CommonParameters>]
Find-PSResource
    [-Prerelease]
    -CommandName <String[]>
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]
Find-PSResource
    [-Prerelease]
    -DscResourceName <String[]>
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

Description

The Find-PSResource cmdlet searches for a package from a repository (local or remote) based on a name or other package properties.

Examples

Example 1

This examples searches PowerShell Gallery for the PowerShellGet package. The cmdlet returns the highest non-prerelease version.

Find-PSResource -Name PowerShellGet -Repository PSGallery

Name          Version Prerelease Repository Description
----          ------- ---------- ---------- -----------
PowerShellGet 2.2.5              PSGallery  PowerShell module with commands for discovering, installing, updating and p…

Example 2

This examples searches PowerShell Gallery for the PowerShellGet package, including prerelease versions.

Find-PSResource -Name PowerShellGet -Repository PSGallery -Prerelease

Name          Version Prerelease Repository Description
----          ------- ---------- ---------- -----------
PowerShellGet 3.0.21  beta21     PSGallery  PowerShell module with commands for discovering, installing, updating and p…

Example 3

This examples searches PowerShell Gallery for the Microsoft.PowerShell.SecretManagement package. The cmdlet returns all versions that satisfy the specified Version range.

$parameters = @{
    Name = 'Microsoft.PowerShell.SecretManagement'
    Version = '(0.9.0.0, 1.2.0.0]'
    Repository = 'PSGallery'
    Prerelease = $true
}
Find-PSResource @parameters

Name                                  Version Prerelease Repository Description
----                                  ------- ---------- ---------- -----------
Microsoft.PowerShell.SecretManagement 1.1.2              PSGallery  …
Microsoft.PowerShell.SecretManagement 1.1.1              PSGallery  …
Microsoft.PowerShell.SecretManagement 1.1.0   preview2   PSGallery  …
Microsoft.PowerShell.SecretManagement 1.1.0   preview    PSGallery  …
Microsoft.PowerShell.SecretManagement 1.1.0              PSGallery  …
Microsoft.PowerShell.SecretManagement 1.0.1              PSGallery  …
Microsoft.PowerShell.SecretManagement 1.0.0              PSGallery  …
Microsoft.PowerShell.SecretManagement 0.9.1              PSGallery  …

Example 4

This examples searches for all module resources containing the CommandName of Get-TargetResource. The cmdlet returns all the module resources that include the command.

Find-PSResource -CommandName Get-TargetResource -Repository PSGallery

Name                 Package Name               Version
----                 ------------               -------
{Get-TargetResource} cRegFile                   1.2
{Get-TargetResource} cVNIC                      1.0.0.0
{Get-TargetResource} cWindowsErrorReporting     1.1
{Get-TargetResource} OctopusDSC                 4.0.1131
{Get-TargetResource} supVsts                    1.1.17.0
{Get-TargetResource} SystemLocaleDsc            1.2.0.0
{Get-TargetResource} WindowsDefender            1.0.0.4
{Get-TargetResource} xInternetExplorerHomePage  1.0.0
{Get-TargetResource} xPowerShellExecutionPolicy 3.1.0.0

Example 5

This examples searches for all module resources containing the DSC Resource SystemLocale.

Find-PSResource -DscResourceName SystemLocale -Repository PSGallery

Name           Package Name          Version
----           ------------          -------
{SystemLocale} ComputerManagementDsc 9.0.0
{SystemLocale} SystemLocaleDsc       1.2.0.0

Example 6

This example searches all registered PSResourceRepositories for resources with names starting with Computer.

Find-PSResource -Name Computer*

Name                                              Version Prerelease Repository Description
----                                              ------- ---------- ---------- -----------
ComputerManagementDsc                             9.0.0              PSGallery  DSC resources for configuration of a Wi…
ComputerManagement                                1.1.2.3            PSGallery  A PowerShell module for working with th…
ComputerCleanup                                   1.2.0              PSGallery  Module for freeing up disk space / remo…
Computer_UnjoinDomainAndJoinWorkgroup_Config      1.0.0              PSGallery  This example switches the computer 'Ser…
Computer_SetComputerDescriptionInWorkgroup_Config 1.0.0              PSGallery  This example will set the computer desc…
Computer_RenameComputerInWorkgroup_Config         1.0.0              PSGallery  This example will set the machine name …
Computer_RenameComputerInDomain_Config            1.0.0              PSGallery  This example will change the machines n…
Computer_RenameComputerAndSetWorkgroup_Config     1.0.0              PSGallery  This configuration will set the compute…
Computer_JoinDomainSpecifyingDC_Config            1.0.0              PSGallery  This configuration sets the machine nam…
Computer_JoinDomain_Config                        1.0.0              PSGallery  This configuration sets the machine nam…

Example 7

This example shows how to find modules by a tag. The CrescendoBuilt value is a tag that's automatically added to modules created using the Microsoft.PowerShell.Crescendo module.

Find-PSResource -Tag CrescendoBuilt

Name            Version Prerelease Repository Description
----            ------- ---------- ---------- -----------
AptPackage      0.0.2              PSGallery  PowerShell Crescendo-generated Module to query APT-Package Information
Cobalt          0.4.0              PSGallery  A PowerShell Crescendo wrapper for WinGet
Croze           0.0.5              PSGallery  A PowerShell Crescendo wrapper for Homebrew
Foil            0.3.0              PSGallery  A PowerShell Crescendo wrapper for Chocolatey
Image2Text      1.0.2              PSGallery  PowerShell Images into ASCII art
pastel          1.0.1              PSGallery  PowerShell commands for pastel
PSDupes         0.0.1              PSGallery  A crescendo module to locate duplicate files. Very fast and easy to use, …
psFilesCli      0.0.3              PSGallery  A PowerShell wrapper for files-cli.exe
PSLogParser     0.0.2              PSGallery  Crescendo Powershell module for Log Parser 2.2
Quser.Crescendo 0.1.3              PSGallery  This module displays session information of users logged onto a local or …
RoboCopy        1.0.1              PSGallery  PowerShell cmdlet for the official RoboCopy.exe
SpeedTest-CLI   1.0.1              PSGallery  PowerShell cmdlets for Internet Speed Test
SpeedTestCLI    1.0.0              PSGallery  PowerShell cmdlets speedtest-cli
SysInternals    1.1.0              PSGallery  PowerShell cmdlets for SysInternal tools
Takeown         1.0.2              PSGallery  Crescendo Powershell wrapper of takeown.exe
TShark          1.0.2              PSGallery  PowerShell cmdlet for tshark.exe
VssAdmin        0.8.0              PSGallery  This is a Crescendo module to wrap the Windows `vssadmin.exe` command-lin…

Parameters

-CommandName

The name of the command to search for.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Optional credentials to be used when accessing a repository.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DscResourceName

The name of the DSC Resource to search for.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-IncludeDependencies

When specified, search returns all matching resources their dependencies. Dependencies are deduplicated.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Name of a resource to find. Wildcards are supported but NuGet only accepts the * character. NuGet doesn't support wildcard searches of local (file-based) repositories.

Type:String[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-Prerelease

When specified, includes prerelease versions in search results returned.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Repository

Specifies one or more repository names to search. If not specified, search includes all registered repositories, in priority order (highest first), until a repository is found that contains the package. Repositories are sorted by priority then by name. Lower Priority values have a higher precedence.

When searching for resources across multiple repositories, the PSResourceGet cmdlets search the repositories using this sort order. Find-PSResource returns all matching packages from the sorted list of repositories.

The parameter supports the * wildcard character. If you specify multiple repositories, all names must include or omit the wildcard character. You can't specify a mix of names with and without wildcards.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-Tag

Filters search results for resources that include the specified tags. If multiple tags are specified, the cmdlet only returns resources that include all the tags provided.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Type

Specifies one or more resource types to find. Resource types supported are:

  • None
  • Module
  • Script
Type:Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceType
Accepted values:None, Module, Script, Nupkg
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Version

Specifies the version of the resource to be returned. The value can be an exact version or a version range using the NuGet versioning syntax.

Wildcards are supported but NuGet only accepts wildcard character *. For more information about NuGet version ranges, see Package versioning.

PowerShellGet supports all but the minimum inclusive version listed in the NuGet version range documentation. Using 1.0.0.0 as the version doesn't yield versions 1.0.0.0 and higher (minimum inclusive range). Instead, the value is considered to be the required version. To search for a minimum inclusive range, use [1.0.0.0, ] as the version range.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

Inputs

String[]

Outputs

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCommandResourceInfo

Notes

The module defines fdres as an alias for Find-PSResource.