Unregister-PSResourceRepository
從本機電腦移除已註冊的存放庫。
語法
Unregister-PSResourceRepository
[-Name] <String[]>
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Cmdlet 會從本機電腦移除已註冊的存放庫。
範例
範例 1
在此範例中,會從本機電腦移除存放 PSGv3
庫。
Get-PSResourceRepository
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 True 10
Local file:///D:/PSRepoLocal/ True 20
PSGv3 https://www.powershellgallery.com/api/v3 True 50
Unregister-PSResourceRepository -Name PSGv3
Get-PSResourceRepository
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 True 10
Local file:///D:/PSRepoLocal/ True 20
範例 2
此範例示範如何在單一命令中移除多個已註冊的存放庫。 Name參數接受陣列,其中包含要移除的存放庫名稱。
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
Unregister-PSResourceRepository -Name PoshTestGallery, psgettestlocal
Get-PSResourceRepository
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 False 50
參數
-Confirm
在執行 Cmdlet 前提示您確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | False |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Name
要移除的一或多個存放庫名稱。
類型: | String[] |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-PassThru
指定時,會針對已移除的每個存放庫輸出 PSRepositoryInfo 物件。
類型: | SwitchParameter |
Position: | Named |
預設值: | False |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示執行 Cmdlet 後會發生的情況。 不會執行此 Cmdlet。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | False |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
輸入
String[]
輸出
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo
根據預設,Cmdlet 不會傳回任何物件。 使用 PassThru 參數時,Cmdlet 會針對已移除的每個存放庫輸出 PSRepositoryInfo 物件。