PowerShell Get-PSRepository 查看存储库信息

环境配置说明

  • Windows 21H1
  • PSVersion 5.1.19041.1320

示例

PS C:\Users\admin> help *repository*
Name                              Category  Module                    Synopsis
----                              --------  ------                    --------
Register-PSRepository             Function  PowerShellGet             ...
Unregister-PSRepository           Function  PowerShellGet             ...
Set-PSRepository                  Function  PowerShellGet             ...
Get-PSRepository                  Function  PowerShellGet             ...
PS C:\Users\admin> Get-PSRepository
Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery...

Expopowershell怎么打开rt-Clixml 将结果保存为xml文件

  • 此处是powershell专用的xml,与常见xml存在差异。
PS C:\Users\admin> Get-PSRepository | Export-Clixml psrepo.xml
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>Microsoft.PowerShell.Commands.PSRepository</T>
<T>System.Management.Automation.PSCustomObject</T>
<T>System.Object</T>
</TN>
<MS>
<S N="Name">PSGallery</S>
<S N="SourceLocation">https://www.powershellgallery.com/api/v2</S>
<B N="Trusted">false</B>
<B N="Registered">true</B>
<S N="InstallationPolicy">Untrusted</S>
<S N="PackageManagementProvider">NuGet</S>
<S N="PublishLocation">https://www.powershellgallery.com/api/v2/package/</S>
<S N="ScriptSourceLocation">https://www.powershellgallery.com/api/v2/items/psscript</S>
<S N="ScriptPublishLocation">https://www.powershellgallery.com/api/v2/package/</S>
<Obj N="ProviderOptions" RefId="1">
<TN RefId="1">
<T>System.Collections.Hashtable</T>
<T>System.Object</T>
</TN>
<DCT />
</Obj>
</MS>
</Obj>
</Objs>

windows11有必要升级吗

学习资料

  • PowerShell 版本 + 工具
  • PowerShell/windows11有必要升级吗PowerShell
  • 51C系统运维工程师TO社区


感恩曾经powershell管理员怎么打开帮助过 师万物 的人。
学有余力的话,可以了解具有开源、跨平台特性的Powershell Core。
欢迎关注公众号:悟为生心