Intento usar el cmdlet Get-Help para mostrar la ayuda basada en comentarios en el mismo formato en el que muestra los temas de ayuda de cmdlet que se generan de archivos XML. La capacidad de hacerlo está documentada en about_Comment_based_Help en TechNet, pero cuando ejecuto el cmdlet get-help contra mi script solo obtengo el nombre del script. ¡Cualquier ayuda sería apreciada!Use el cmdlet Get-Help para mostrar la ayuda basada en comentarios en el mismo formato
PS C:\Admin> Get-Help .\checksystem.ps1 -full
checksystem.ps1
guión checksystem.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
En PowerShell versión 3, los comentarios funcionan tanto dentro como fuera de una función: http://technet.microsoft.com/en-us/library/dd819489.aspx –
Aún mejor, en PowerShell 3, ni siquiera necesita marcar el parámetro ayuda. Simplemente haga un comentario regular sobre el parámetro y PowerShell lo averigua. – Josh
Según estos http://technet.microsoft.com/en-us/library/dd819489.aspx comentarios fuera de la función también se aplica a powershell 2.0. – Raj