Hey there,
Hope someone can help me with this one. I have the following code
Function Get-xos{
[CmdletBinding()]
Param (
[Parameter(Mandatory=$True,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage= 'One or more computer names')]
[Alias('Host')]
[String[]]$ComputerName
)
Begin{}
Process
{
ForEach($c in $ComputerName)
{
$os = Get-WmiObject -ComputerName $c -Class Win32_OperatingSystem
$Prop = [ordered]@{
“OSVersion” = $os.Version
“OSBuild” = $os.BuildNumber
}
$Obj=New-Object -TypeName PSObject -Property $Prop
Write-Output $obj
}
}
End{}
}
when i then run
get-help Get-xos -Parameter computername
i get the following output
-ComputerName <string>
One or more computer names
Required? true
Position? 0
Accept pipeline input? true (ByValue, ByPropertyName)
Parameter set name (All)
Aliases Host
Dynamic? false
exactly what i want and as expected.
But if i then add a comment to the function
Function Get-xos{
<#
.DESCRIPTION
Get OS version information
#>
…
and run the same command, i get the following output
defaultValue :
parameterValue : String
name : ComputerName
type : @{name=String}
required : true
globbing : false
pipelineInput : true (ByValue, ByPropertyName)
position : 1
what am I doing wrong. I want to create a ps1 file with multiple functions, and add comments , a description to each function. I have also tried to add the comment block right above the function, but that does not make a difference.
Any help is appreciated.
Alex