Reset-PSResourceRepository
创建一个新的默认 PSRepositories.xml 文件,注册了PSGallery。
语法
Default (默认值)
Reset-PSResourceRepository
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
该命令通过创建带有 PSGallery 注册的存储文件来重置仓库存储。 首先它会创建一个新的临时文件,只有在创建成功时才替换旧文件。 如果创建失败,旧文件会被恢复。
使用此命令替换损坏的仓库存储或恢复默认仓库配置。
该命令是在 Microsoft.PowerShell.PSResourceGet v1.2.0-preview5 中添加的。
示例
示例1 - 重置仓库存储并显示结果
Reset-PSResourceRepository -PassThru
Name Uri Trusted Priority IsAllowedByPolicy
---- --- ------- -------- -----------------
PSGallery https://www.powershellgallery.com/api/v2 True 50 True
参数
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | cf |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PassThru
默认情况下,该命令不产生任何输出。 指定后,命令显示复位作的结果。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未能运行。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 无线 |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。