Page 1 of 1 1
Topic Options
#167074 - 2006-09-08 10:38 AM Add SMTP and set primary
krex Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 39
Hi!
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

Code:


$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)
$UserData.SetInfo()
Endif
Next


Top
#167075 - 2006-09-08 11:25 AM Re: Add SMTP and set primary
krex Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 39
Sorry!
Found the Solution if you write smtp with uppecase it becomes the Primary SMTP
and if you use lowercase if becomes secondary.
So my array will look this if i want my $newmail as primary and the $oldmail as secondary.
Code:

$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:"+$oldMail+"@@???.??"
$UserData.Put ("proxyAddresses", $Array)
$UserData.SetInfo()
Endif
Next



Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 175 anonymous users online.
Newest Members
gkustra, emnipetro, Hirze, thequeen, ameliaryan
17642 Registered Users

Generated in 0.05 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org