共用方式為


Get-PSResourceRepository

尋找並傳回已註冊的存放庫資訊。

語法

Default (預設值)

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

Description

此 Cmdlet 會搜尋電腦上已註冊的 PowerShell 資源存放庫。 根據預設,它會傳回所有已註冊的存放庫。

範例

範例 1

此範例會傳回電腦上註冊的所有存放庫。

Get-PSResourceRepository
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PoshTestGallery  https://www.poshtestgallery.com/api/v2          True         40
PSGallery        https://www.powershellgallery.com/api/v2       False         50
psgettestlocal   file:///c:/code/testdir                         True         50

範例 2

此範例會使用 Name 參數來取得特定存放庫。

Get-PSResourceRepository -Name PSGallery
Name         Uri                                        Trusted   Priority
----         ---                                        -------   --------
PSGallery    https://www.powershellgallery.com/api/v2     False         50

範例 3

此範例會使用 Name 參數來取得以 Gallery結尾的所有存放庫。

Get-PSResourceRepository -Name "*Gallery"
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PoshTestGallery  https://www.poshtestgallery.com/api/v2          True         40
PSGallery        https://www.powershellgallery.com/api/v2       False         50

範例 4

這個範例會使用 Name 參數來取得具名存放庫的清單。

Get-PSResourceRepository -Name "PSGallery","PoshTestGallery"
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PoshTestGallery  https://www.poshtestgallery.com/api/v2          True         40
PSGallery        https://www.powershellgallery.com/api/v2       False         50

參數

-Name

要搜尋的存放庫名稱。 支援通配符。 此參數的索引標籤完成會迴圈查看已註冊的存放庫名稱。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:True
不要顯示:False

參數集

(All)
Position:0
必要:False
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸入

String

輸出

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo