Hi Everyone! Thanks at first!
I have an Issue, I don’t understand this behavior.
My Function Get-Test2 tell me the Manufacture, examples:
PS C:\> Get-Test2 127.0.0.1
Computername Manufacturer
127.0.0.1 Dell Inc.
It’s OK, this is what I want
PS C:\> "127.0.0.1" | Get-Test2
Computername Manufacturer
127.0.0.1 Dell Inc.
It’s OK
But, from the Pipeline Of a Get-adcomputer command.
PS C:\> Get-ADComputer test | Get-Test2
Computername Manufacturer
CN=test,CN=Computers,DC=R,DC=LAN Dell Inc.
I get
DistinguishedName : CN=SI,CN=Computers,DC=R,DC=LAN, I don’t want DistinguishedName, I want DNSHostname
I put an alias, but appears It doesn’t work.
This is my Psrameter:
[Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [Alias("DNSHostname")] [string]$DNSHost
Can anyone explain me this behavior?
Thanks!