Get-PSResourceRepository

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

Syntax

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

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

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

輸入

String[]

輸出

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo