Change UPN does not work
hello everyone,
trying schedule script new users , set them correct upn suffix instead of default one.
using one:
$oldsuffix = '@mydefault.com' $newsuffix = '@mygoodone.com'
get-aduser -searchbase "ou=users,ou=accounts,ou=uk,ou=emea,dc=contoso,dc=com" -searchscope onelevel -filter * | foreach-object {
$newupn = $_.userprincipalname.replace($oldsuffix,$newsuffix) $_ | set-aduser -server dc01 -userprincipalname $newupn -whatif }
the script seems work fine, no error displayed, when check in aduc mmc in account tab of user's properties or when :
get-aduser -filter * -searchbase "ou=users,ou=accounts,ou=uk,ou=emea,dc=contoso,dc=com" -properties userprincipalname
the userprincipalname of user accounts still displaying oldsuffix !
missing ?
lot :)
hi,
you have -whatif parameter specified on set-aduser, no changes made.
don't retire technet! - (don't give yet - 12,700+ strong , growing)
Windows Server > Windows PowerShell
Comments
Post a Comment