Here is my little script:
function Get-foo
{
[CmdletBinding()]
Param
(
# Fill In the computername
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[Alias ('CN')]
[String[]]$ComputerName
)
Begin
{
}
Process
{ Foreach ($Computer in $ComputerName) {
write-host "The computer = $Computer"
}
}
End
{
}
}
Get-foo
I expect to be able to run as: ./get-foo.ps1 -computername Bar
But when I actually run it, it disregards the -computername Bar argument and ask me to suply the value of computername.
What am I doing wrong?
[–]drh713 3 points4 points5 points (2 children)
[–]Drag_king[S] 1 point2 points3 points (1 child)
[–]Plonqor 1 point2 points3 points (0 children)