I've a failry simple script that at some point gets to this line
$user = get-aduser -Server <server> -Filter { UserPrincipalName -eq $email } -Properties passwordlastset, passwordneverexpires, Name, DisplayName,UserPrincipalName, extensionattribute15,SamAccountName | Select-Object Name, SamAccountName, DisplayName,UserPrincipalName, extensionattribute15, passwordlastset, passwordneverexpires
- If i run this script on AD1 with -Server set to AD1 it displays passwordlastset and passwordneverexpires as expected.
- If i run this script on AD1 with -Server set to AD2 it displays the output as expected.
I then copy the same script to AD2 and run it
- If i run this script on AD2 with -server set to AD1 it displays fields correctly.
- If i run it on AD2 with -server set to AD2 it displays no values for passwordlastset, passwordneverexpires and extensionattribute. All other fields are displayed correctly.
Why would there be a difference?