我尝试使用 Get-Help cmdlet 以与显示从 XML 文件生成的 cmdlet 帮助主题相同的格式显示基于注释的帮助。执行此操作的能力记录在about_Comment_based_Help http://technet.microsoft.com/en-us/library/dd819489.aspx在 TechNet 上,但是当我对脚本执行 get-help cmdlet 时,我只得到返回的脚本名称。任何帮助,将不胜感激!
PS C:\Admin> Get-Help .\checksystem.ps1 -full
checksystem.ps1
检查system.ps1脚本:
function IsAlive {
<#
.DESCRIPTION
Checks to see whether a computer is pingable or not.
.PARAMETER computername
Specifies the computername.
.EXAMPLE
IsAlive -computername testwks01
.NOTES
This is just an example function.
#>
param (
$computername
)
Test-Connection -count 1 -ComputerName $computername -TimeToLive 5 |
Where-Object { $_.StatusCode -eq 0 } |
Select-Object -ExpandProperty Address
}
IsAlive -computername 192.168.1.1
它会起作用,但您正在尝试运行脚本的“获取帮助”。您已将帮助添加到该函数中。如果您获取脚本,然后输入 get-help isalive,您将看到该函数的帮助。
. .\checksystem.ps1 ; get-help isalive -full
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)