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
cmdlet 根据名称或其他包属性从存储库 (本地或远程) 搜索包。
示例
示例 1
此示例PowerShell 库搜索 PowerShellGet 包。 cmdlet 返回非预发行版的最高版本。
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
此示例PowerShell 库搜索 PowerShellGet 包,包括预发行版。
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
此示例PowerShell 库搜索 Microsoft.PowerShell.SecretManagement 包。 cmdlet 返回满足指定版本范围的所有 版本 。
$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
此示例搜索包含 CommandName 的所有 Get-TargetResource
模块资源。 cmdlet 返回包含 命令的所有模块资源。
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
此示例演示如何通过标记查找模块。 值 CrescendoBuilt
是自动添加到使用 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…
参数
-CommandName
要搜索的命令的名称。
类型: | String[] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Credential
访问存储库时要使用的可选凭据。
类型: | PSCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DscResourceName
要搜索的 DSC 资源的名称。
类型: | String[] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-IncludeDependencies
指定后,搜索将返回其依赖项的所有匹配资源。 依赖项已删除重复。
类型: | SwitchParameter |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Name
要查找的资源的名称。 支持通配符,但 NuGet 仅接受 *
字符。 NuGet 不支持对基于文件的本地 () 存储库进行通配符搜索。
类型: | String[] |
Position: | 0 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | True |
-Prerelease
指定后,在返回的搜索结果中包括预发行版本。
类型: | SwitchParameter |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Repository
指定要搜索的一个或多个存储库名称。 如果未指定,搜索将包括所有已注册的存储库,按优先级顺序 (最高的第一个) ,直到找到包含包的存储库。 存储库按优先级排序,然后按名称排序。 优先级较低的值具有较高的优先级。
跨多个存储库搜索资源时, PSResourceGet cmdlet 使用此排序顺序搜索存储库。
Find-PSResource
从存储库的排序列表中返回所有匹配的包。
参数支持 *
通配符。 如果指定多个存储库,则所有名称都必须包含或省略通配符。 不能使用和不使用通配符指定混合名称。
类型: | String[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | True |
-Tag
筛选包含指定标记的资源的搜索结果。 如果指定了多个标记,则 cmdlet 仅返回包含提供的所有标记的资源。
类型: | String[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Type
指定要查找的一个或多个资源类型。 支持的资源类型包括:
None
Module
Script
类型: | Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceType |
接受的值: | None, Module, Script |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Version
指定要返回的资源的版本。 该值可以是使用 NuGet 版本控制语法的确切版本或版本范围。
支持通配符,但 NuGet 仅接受通配符 *
。 有关 NuGet 版本范围的详细信息,请参阅 包版本控制。
PowerShellGet 支持 NuGet 版本范围文档中列出的 除最低非独占版本 之外的所有版本。 使用 1.0.0.0
作为版本不会生成版本 1.0.0.0 及更高版本, (最小非独占范围) 。 相反,该值被视为所需的版本。 若要搜索最小非独占范围,请使用 [1.0.0.0, ]
作为版本范围。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | True |
输入
String[]
输出
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCommandResourceInfo
备注
模块将 fdres
定义为 的 Find-PSResource
别名。