Powershell 2:如何消除重复的帮助条目?

Lar*_*old 5 powershell documentation

我经常拨打这样的电话:

get-help <some-command>
Run Code Online (Sandbox Code Playgroud)

在 Powershell 2 中。对于这些命令中的许多(但不是全部),我没有看到帮助条目的内容。相反,我得到重复项,并且仅显示帮助对象本身:

[PS2]> get-help remove-distributiongroup | more

Name                              Category  Synopsis
----                              --------  --------
Remove-DistributionGroup          Cmdlet    Use the Remove-DistributionGroup...
Remove-DistributionGroup          Cmdlet    Use the Remove-DistributionGroup...
Run Code Online (Sandbox Code Playgroud)

作为一个完全的 PS 新手,我通过执行类似于以下的操作来解决这个问题:

[PS2]> $var = get-help remove-distributiongroup
[PS2]> $var[0] | get-member
... Output ...
[PS2]> $var[0].Parameters |more
... Part of the documentation ...
[PS2]> $var[0].Synopsis |more
... Another part of the documentation ...
Run Code Online (Sandbox Code Playgroud)

有几个问题。

  • 我的 Windows 管理员同事知道如何删除重复条目吗?我只是一个 Unix 人。
  • 如果没有,是否有一种更简单的方法来获得我需要的东西,而不是我上面想出的复杂的黑客方法?

谢谢!

[更新[:

尝试了pk的建议,但遗憾的是这没有用。这是通过 select -unique 进行管道传输时的输出:

Name                              Category  Synopsis
----                              --------  --------
Get-DistributionGroup             Cmdlet    Use the Get-DistributionGroup cm...
Run Code Online (Sandbox Code Playgroud)

pk.*_*pk. 0

我不确定为什么你会收到重复的信息。我无法重现这个问题,但我确实知道如何以稍微更优雅的方式解决它。

get-help remove-distributiongroup | select -unique
Run Code Online (Sandbox Code Playgroud)

那样有用吗?

这会返回什么?

Test-Path -path "$pshome\Help.format.ps1xml"
Run Code Online (Sandbox Code Playgroud)

此文件包含由 Get-Help 返回的 MamlCommandHelpInfo 对象的格式化视图。