Is "msExchUsageLocation" the LDAP name for the property? I think it's just usageLocation. Give that a try.
Unable to pass value to set-aduser command.
Mike
246
Reputation points
I have this code supplemented by an xml file.
the first line is successful. But Since I want to add a value after the account is created, It doesn't set the value from $domainConfiguration.Geolocation.
If I try to write-host $domainConfiguration.Geolocation is does output the string I have in the xml file. I am not really sure what is wrong with this.
New-ADUser -Server $Script:DC @PrimaryUserParam
Set-Aduser -Server $Script:DC $PrimaryUserParam.SamAccountName -Replace @{msExchUsageLocation = "$($DomainConfiguration.UsageLocation)"}