All of our users need a new mail address. So i Want to add that new e-mail address. I put a post a part of my script below here.
Now my problem is that if i add tha new address the old address get delete so i save the old one and then try 2 add both and the works .
My Problem is that both E-mail Addresse get primary and i can not delete Primary address in Active Directory
So how do i add the 2 adresse and make Sure that only the new is primary
I dont know if this command will work i cant seem to get working ADS_PROPERTY_UPDATE
$NewMail = "MyNew"
$OLDMAIL = "MyOld"
$Grp = GetObject ("LDAP://cn=somegroup,OU=Some place,dc=my,dc=domain,dc=com")
For Each $User in $Grp.Member
$Userdata = GetObject ("LDAP://"+$User)
IF $UserData.sAMAccountName = "Aname"
$Array = "SMTP:"+$NewMail+"@@????.??","SMTP:"+$NewMail+"@@???.??"
$UserData.Put ("proxyAddresses", $Array)