次の方法で共有


Find-PSResource

名前やその他のパッケージ プロパティに基づいて、リポジトリ (ローカルまたはリモート) からパッケージを検索します。

構文

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

説明

コマンドレットは Find-PSResource 、名前やその他のパッケージ プロパティに基づいて、リポジトリ (ローカルまたはリモート) からパッケージを検索します。

例 1

次の例では、PowerShellGet パッケージのPowerShell ギャラリーを検索します。 コマンドレットは、プレリリース以外の最高バージョンを返します。

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…

例 2

この例では、プレリリース バージョンを含む PowerShellGet パッケージのPowerShell ギャラリーを検索します。

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…

例 3

この例では、Microsoft.PowerShell.SecretManagement パッケージのPowerShell ギャラリーを検索します。 コマンドレットは、指定されたバージョン範囲を満たすすべての バージョン を返します。

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

例 4

この例では、 の CommandNameGet-TargetResourceを含むすべてのモジュール リソースを検索します。 コマンドレットは、 コマンドを含むすべてのモジュール リソースを返します。

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

例 5

この例では、DSC リソース を含むすべてのモジュール リソースを検索します SystemLocale

Find-PSResource -DscResourceName SystemLocale -Repository PSGallery

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

例 6

この例では、登録されているすべての PSResourceRepositories で始まる名前のリソースを 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…

例 7

この例では、タグによってモジュールを検索する方法を示します。 値は CrescendoBuiltMicrosoft.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…

パラメーター

-CommandName

検索するコマンドの名前。

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

-Credential

リポジトリにアクセスするときに使用するオプションの資格情報。

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

-DscResourceName

検索する DSC リソースの名前。

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

-IncludeDependencies

指定すると、検索は一致するすべてのリソースの依存関係を返します。 依存関係は重複除去されます。

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

-Name

検索するリソースの名前。 ワイルドカードはサポートされていますが、NuGet では 文字のみを受け入れます * 。 NuGet では、ローカル (ファイルベース) リポジトリのワイルドカード検索はサポートされていません。

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

-Prerelease

指定すると、返される検索結果にプレリリース バージョンが含まれます。

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

-Repository

検索する 1 つ以上のリポジトリ名を指定します。 指定しない場合、パッケージを含むリポジトリが見つかるまで、検索には、登録されているすべてのリポジトリが優先順位 (最も高い順) で含まれます。 リポジトリは優先度順に並べ替えられた後、名前で並べ替えられます。 優先度の値が低いほど優先順位が高くなります。

複数のリポジトリ間でリソースを検索する場合、 PSResourceGet コマンドレットは、この並べ替え順序を使用してリポジトリを検索します。 Find-PSResource は、並べ替えられたリポジトリの一覧から一致するすべてのパッケージを返します。

パラメーターはワイルドカード文字を * サポートしています。 複数のリポジトリを指定する場合は、すべての名前にワイルドカード文字を含めるか省略する必要があります。 ワイルドカードの有無にかかわらず、名前の組み合わせを指定することはできません。

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

-Tag

指定したタグを含むリソースの検索結果をフィルター処理します。 複数のタグが指定されている場合、コマンドレットは、指定されたすべてのタグを含むリソースのみを返します。

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

-Type

検索する 1 つ以上のリソースの種類を指定します。 サポートされているリソースの種類は次のとおりです。

  • 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

返されるリソースのバージョンを指定します。 値には、NuGet のバージョン管理構文を使用して、正確なバージョンまたはバージョン範囲を指定できます。

ワイルドカードはサポートされていますが、NuGet ではワイルドカード文字 *のみを使用できます。 NuGet のバージョン範囲の詳細については、「 パッケージのバージョン管理」を参照してください。

PowerShellGet では、NuGet のバージョン範囲に関するドキュメントに記載されている 最小包括バージョン 以外のすべてのバージョンがサポートされています。 バージョンとして を使用 1.0.0.0 しても、バージョン 1.0.0.0 以降 (最小包括範囲) は生成されません。 代わりに、値は必要なバージョンと見なされます。 最小包括範囲を検索するには、バージョン範囲として を使用 [1.0.0.0, ] します。

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

入力

String[]

出力

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCommandResourceInfo

メモ

モジュールは、 の fdres エイリアス Find-PSResourceとして を定義します。