Unregister-PSResourceRepository
从本地计算机中删除已注册的存储库。
语法
Unregister-PSResourceRepository
[-Name] <String[]>
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
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 之前进行确认。
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
要删除的一个或多个存储库的名称。
Type: | String[] |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PassThru
指定后,为每个已删除的存储库输出 PSRepositoryInfo 对象。
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
输入
String[]
输出
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo
默认情况下,cmdlet 不返回任何对象。 使用 PassThru 参数时,cmdlet 会为删除的每个存储库输出 PSRepositoryInfo 对象。
相关链接
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈