Get-PSRepository

获取 PowerShell 存储库。

语法

Default (默认值)

Get-PSRepository
    [[-Name] <String[]>]
    [<CommonParameters>]

说明

Get-PSRepository cmdlet 获取为当前用户注册的 PowerShell 模块存储库。

这是 Get-PSResourceRepository 中 cmdlet 的代理 cmdlet。 有关详细信息,请参阅 Get-PSResourceRepository

示例

示例 1:获取所有模块存储库

Get-PSRepository

此命令获取为当前用户注册的所有模块存储库。

示例 2:按名称获取模块存储库

Get-PSRepository -Name "*NuGet*"

此命令获取名称中包含 NuGet 的所有模块存储库。

示例 3:获取模块存储库并设置输出格式

Get-PSRepository -Name "Local01" | Format-List * -Force
Name                      : local01
SourceLocation            : http://manikb-dev:8765/api/v2/
Trusted                   : True
Registered                : True
InstallationPolicy        : Trusted
PackageManagementProvider : NuGet
PublishLocation           : http://pattif-dev:8765/api/v2/package/
ScriptSourceLocation      : http://pattif-dev:8765/api/v2/artifacts/psscript
ScriptPublishLocation     : http://pattif-dev:8765/api/v2/package/
ProviderOptions           : {}

此命令获取名为 Local01 的存储库,并使用管道运算符将该对象传递给 Format-List cmdlet。

参数

-Name

指定要获取的存储库的名称。

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:0
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

String

输出

Object