Hi!
I am trying to create a CMDlet that will get input from Get-ADuser or Get-ADComputer but i can't get it to work with the ValueFromPipelineByPropertyName property.
The script below only outputs the name of the user or computer but it does not work with Get-ADuser or Get-ADcomputer, it does work if i create my own object as you can see below
function Just-a-Test { [CmdletBinding()] [OutputType([int])] Param ( # Param1 help description [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [Alias("Name")] $TheName ) Begin { } Process { Write-Host $thename } End { } } $obj = New-Object psobject -Property @{name = "test"} # Output: Test $obj | Just-a-Test #Output: Just empty rows, Why oh why? Get-ADComputer -Filter * | Just-a-Test
Any idea why?
Thanks!