Find-Script
查找脚本。
语法
Default (默认值)
Find-Script
[[-Name] <String[]>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-RequiredVersion <String>]
[-AllVersions]
[-IncludeDependencies]
[-Filter <String>]
[-Tag <String[]>]
[-Includes <String[]>]
[-Command <String[]>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Repository <String[]>]
[-Credential <PSCredential>]
[-AllowPrerelease]
[<CommonParameters>]
说明
该 Find-Script cmdlet 在已注册的存储库中查找指定的脚本。
这是 Find-PSResource 中 cmdlet 的代理 cmdlet。 有关详细信息,请参阅 Find-PSResource。
示例
示例 1:按名称查找脚本
Find-Script -Name "Start-WFContosoServer"
此命令查找名为 Start-WFContosoServer..
示例 2:按名称、所需版本和指定存储库查找脚本
Find-Script -Name "Required-Script2" -RequiredVersion 2.0 -Repository "LocalRepo01"
此命令在 LocalRepo01 存储库中按名称和所需版本查找脚本。
示例 3:在指定的版本范围内查找脚本
Find-Script -Name "Required-Script2" -MinimumVersion 2.1 -MaximumVersion 2.5 -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
此命令查找 LocalRepo1 存储库中 2.1 和 2.5 版本之间的 RequiredScript2 的所有版本。
示例 4:查找脚本的所有版本
Find-Script -Name "Required-Script02" -AllVersions
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
1.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
2.0 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
此命令查找 Required-Script02 的所有版本。
示例 5:查找脚本及其依赖项
Find-Script -Name "Script-WithDependencies1" -IncludeDependencies -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Script-WithDependencies1 Script LocalRepo1 Description for the Script-WithDependencies1 script
2.0 RequiredModule3 Script LocalRepo1 RequiredModule3 module
2.5 Required-Script1 Script LocalRepo1 Description for the Required-Script1 script
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
此命令查找脚本及其依赖项。
示例 6:查找具有指定标记的脚本
Find-Script -Tag "Tag1" -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Fabrikam-ClientScript Script LocalRepo1 Description for the Fabrikam-ClientScript script
此命令查找在 LocalRepo1 存储库中具有标记 Tag1 的脚本
示例 7:查找具有指定命令名称的脚本
Find-Script -Command Test-FunctionFromScript_Required-Script3 -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script3 Script LocalRepo1 Description for the Required-Script3 script
此命令查找包含指定命令名称的脚本。
示例 8:使用通配符查找脚本
Find-Script -Name "Required-Script*" -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script1 Script local1 Description for the Required-Script1 script
2.5 Required-Script2 Script local1 Description for the Required-Script2 script
2.5 Required-Script3 Script local1 Description for the Required-Script3 script
此命令使用通配符 (*) 查找以 Required-Script 开头的脚本。
参数
-AllowPrerelease
包括在标记为预发行版的结果脚本中。
代理 cmdlet 将此参数映射到 预发行版 参数 Find-PSResource。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-AllVersions
指示此作查找所有脚本版本。
代理 cmdlet 在调用-Version *之前将此参数Find-PSResource转换为此参数。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Command
代理 cmdlet 忽略此参数,因为 NameParameterSet 不支持 Find-PSResource此参数。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Credential
指定有权访问存储库以搜索脚本的用户帐户。
参数属性
| 类型: | PSCredential |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Filter
代理 cmdlet 忽略此参数,因为 NameParameterSet 不支持 Find-PSResource此参数。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-IncludeDependencies
指示此作获取依赖于 Name 参数中指定的脚本的所有脚本。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Includes
代理 cmdlet 忽略此参数,因为 NameParameterSet 不支持 Find-PSResource此参数。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 接受的值: | Function, Workflow |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-MaximumVersion
代理 cmdlet 使用此参数的值来创建 NuGet 版本搜索字符串,以便与 Version 参数 Find-PSResource一起使用。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-MinimumVersion
代理 cmdlet 使用此参数的值来创建 NuGet 版本搜索字符串,以便与 Version 参数 Find-PSResource一起使用。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Name
指定要查找的脚本名称数组。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | True |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Proxy
代理 cmdlet 忽略此参数,因为 NameParameterSet 不支持 Find-PSResource此参数。
参数属性
| 类型: | Uri |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-ProxyCredential
代理 cmdlet 忽略此参数,因为 NameParameterSet 不支持 Find-PSResource此参数。
参数属性
| 类型: | PSCredential |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Repository
指定通过运行 Register-PSRepository注册的存储库的友好名称。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-RequiredVersion
代理 cmdlet 使用此参数的值来创建 NuGet 版本搜索字符串,以便与 Version 参数 Find-PSResource一起使用。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Tag
指定一个标签数组。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输入
String
String
Uri
PSCredential
输出
PSRepositoryItemInfo
备注
PowerShell 库不再支持传输层安全性(TLS)版本 1.0 和 1.1。 必须使用 TLS 1.2 或更高版本。 使用以下命令确保使用的是 TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12