Share via


Find-PSResource

Procura pacotes de um repositório (local ou remoto), com base num nome ou noutras propriedades do pacote.

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

O Find-PSResource cmdlet procura um pacote a partir de um repositório (local ou remoto) com base num nome ou noutras propriedades do pacote.

Exemplos

Exemplo 1

Estes exemplos procuram Galeria do PowerShell no pacote PowerShellGet. O cmdlet devolve a versão não pré-lançamento mais alta.

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…

Exemplo 2

Estes exemplos procuram Galeria do PowerShell para o pacote PowerShellGet, incluindo versões de pré-lançamento.

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…

Exemplo 3

Estes exemplos procuram Galeria do PowerShell no pacote Microsoft.PowerShell.SecretManagement. O cmdlet devolve todas as versões que satisfazem o intervalo de Versões especificado.

$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  …

Exemplo 4

Estes exemplos procuram todos os recursos do módulo que contêm o CommandName de Get-TargetResource. O cmdlet devolve todos os recursos do módulo que incluem o comando.

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

Exemplo 5

Estes exemplos procuram todos os recursos do módulo que contêm o Recurso SystemLocaledo DSC .

Find-PSResource -DscResourceName SystemLocale -Repository PSGallery

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

Exemplo 6

Este exemplo procura recursos em todos os PSResourceRepositories registados com nomes a começar por 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…

Exemplo 7

Este exemplo mostra como localizar módulos por uma etiqueta. O CrescendoBuilt valor é uma etiqueta que é adicionada automaticamente aos módulos criados com o módulo Microsoft.PowerShell.Crescendo .

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…

Parâmetros

-CommandName

O nome do comando a procurar.

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

-Credential

Credenciais opcionais a utilizar ao aceder a um repositório.

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

-DscResourceName

O nome do Recurso do DSC a procurar.

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

-IncludeDependencies

Quando especificado, a pesquisa devolve todos os recursos correspondentes às respetivas dependências. As dependências são duplicadas.

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

-Name

Nome de um recurso a localizar. Os carateres universais são suportados, mas o NuGet só aceita o * caráter. O NuGet não suporta pesquisas universais de repositórios locais (baseados em ficheiros).

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

-Prerelease

Quando especificado, inclui versões de pré-lançamento nos resultados da pesquisa devolvidos.

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

-Repository

Especifica um ou mais nomes de repositórios a procurar. Se não for especificado, a pesquisa inclui todos os repositórios registados, por ordem de prioridade (primeiro mais alto), até ser encontrado um repositório que contenha o pacote. Os repositórios são ordenados por prioridade e, em seguida, pelo nome. Os valores de Prioridade Inferior têm uma precedência superior.

Ao procurar recursos em vários repositórios, os cmdlets PSResourceGet pesquisam os repositórios com esta sequência de ordenação. Find-PSResource devolve todos os pacotes correspondentes da lista ordenada de repositórios.

O parâmetro suporta o * caráter universal. Se especificar vários repositórios, todos os nomes têm de incluir ou omitir o caráter universal. Não pode especificar uma combinação de nomes com e sem carateres universais.

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

-Tag

Filtra os resultados da pesquisa de recursos que incluem as etiquetas especificadas. Se forem especificadas múltiplas etiquetas, o cmdlet só devolve recursos que incluam todas as etiquetas fornecidas.

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

-Type

Especifica um ou mais tipos de recursos a localizar. Os tipos de recursos suportados são:

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

-Version

Especifica a versão do recurso a devolver. O valor pode ser uma versão exata ou um intervalo de versões com a sintaxe de controlo de versões NuGet.

Os carateres universais são suportados, mas o NuGet só aceita caráter *universal . Para obter mais informações sobre os intervalos de versões do NuGet, veja Controlo de versões do pacote.

O PowerShellGet suporta todas as versões inclusivas mínimas listadas na documentação do intervalo de versões NuGet. Utilizar 1.0.0.0 como a versão não produz as versões 1.0.0.0 e superior (intervalo inclusivo mínimo). Em vez disso, o valor é considerado a versão necessária. Para procurar um intervalo inclusivo mínimo, utilize [1.0.0.0, ] como intervalo de versões.

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

Entradas

String[]

Saídas

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCommandResourceInfo

Notas

O módulo define fdres como um alias para Find-PSResource.