We have found in our org (OnPrem AD that syncs to Azure AD, One way) that we can’t set the country this way -c <country name>. We have to set all three attributes (c, co and countrycode) at the same time using this:
If I try to use this in a New-Aduser command, it gives me the 'a parameter cannot be found that matches parameter name ‘replace’. I also tried using -set instead of replace but I get the same error.
In this situation is it possible to set the country in the New-Aduser command or will I need to wait until it’s created and set it using Set-Aduser?
There is the parameter -Country … but if that’s not enough you can use the parameter -OtherAttributes.
Example 2 shows how to use it:
… and BTW - When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Unfortunately in our setup we can’t just set -Country (-c) independently. We have to set the 3 in combo (-Country, -co and -country code). We spent a couple hours figuring this out about 2 months ago. So I am trying to figure out if I can use it in the new-aduser.
I can try the -OtherAttributes since co and countrycode are not exposed as parameters for this command.