You would see that when I use a variable to capture the value and echo then it returns nothing. But if I directly echo it, it prints the results. This only happens when I execute the command remotely, the local version for the same command works fine.
PS C:\Users\Administrator.ITAPP> invoke-command -computername a01-a01-admin-2 -scriptblock { $dn = ([ADSI]"").distinguis
hedName; echo $dn } -credential $cred
PS C:\Users\Administrator.ITAPP> invoke-command -computername a01-a01-admin-2 -scriptblock { echo ([ADSI]"").distinguish
edName} -credential $cred
DC=itapp,DC=com
PS C:\Users\Administrator.ITAPP> invoke-command -scriptblock { $dn = ([ADSI]"").distinguishedName; echo $dn }
DC=itapp,DC=com
I would very much appreciate any help in resolving this. Thanks much. Merry Christmas!