I am unsure why something like this does not work:
I have a function e.g.:
function get-name
{
[CmdletBinding()]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[alias("SamAccountName")]
$myname
)
Begin
{
}
Process
{
}
End
{
echo $myname
}
}
Load this function, and then try:
get-aduser "name" | get-name
This returns nothing.
Change the Parameter var to $samaccountname it then returns the samaccountname (from the pipeline).
I thought have the alias there should allow it to return that value from the pipeline?
Just wondering if this is something that I have misunderstood?