CFAIT
asked on
How do i set an alias proxyAddresses as the default SMTP.
I've searched EE trying to find a vb script that would set the proxyAddresses in a specific OU starting with "vm-" as the primary SMTP address. i've found listing all proxyAddresses, adding an primary proxyAddresses, etc...
Using vb scripts is there a way to search a specific OU to verify if the proxyAddresses starting with "vm-" is set as the primary? And if it's not, it WILL set as the primary SMTP startig with "vm-" as the default SMTP address.
Thanks in advance for any assistance provided.
Using vb scripts is there a way to search a specific OU to verify if the proxyAddresses starting with "vm-" is set as the primary? And if it's not, it WILL set as the primary SMTP startig with "vm-" as the default SMTP address.
Thanks in advance for any assistance provided.
ASKER
Chris,
Thanks for the reply. Once an account is created the Recipient Policies will set the primary SMTP as the display name "jan.doe@ee.com". Once that's done i can create and set any alias (jdoe@ee.com) as the primary and the Recipient Policy will not revert back to jan.doe. So to answer your question it will agree.
~ross
Thanks for the reply. Once an account is created the Recipient Policies will set the primary SMTP as the display name "jan.doe@ee.com". Once that's done i can create and set any alias (jdoe@ee.com) as the primary and the Recipient Policy will not revert back to jan.doe. So to answer your question it will agree.
~ross
Hey Ross,
Good stuff. I'll put something together to deal with this for you. Probably won't be tonight, hope that's not a bother.
Chris
ASKER
Chris,
Any assistance is appreciated, no worries man. I extremely grateful.
~ross
Any assistance is appreciated, no worries man. I extremely grateful.
~ross
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Chris,
It worked great! It scanned the OU looking for any user having "vm-" as an alias and set it to be the primary SMTP address. However, after setting "vm-" as the primary it doesn't delete the previous proxyAddresses. any thoughts?
Thanks,
Ross
It worked great! It scanned the OU looking for any user having "vm-" as an alias and set it to be the primary SMTP address. However, after setting "vm-" as the primary it doesn't delete the previous proxyAddresses. any thoughts?
Thanks,
Ross
You didn't say you wanted it to, or I missed that :)
Would you like it to only leave the vm- address?
Chris
ASKER
Chris,
You're right, i didn't asked for it. I found a way to remove it using ldifde, but if there is a way to only leave "vm-" address that would be helpful.
Thanks,
Ross
You're right, i didn't asked for it. I found a way to remove it using ldifde, but if there is a way to only leave "vm-" address that would be helpful.
Thanks,
Ross
ASKER
Chris,
If this is taking too much of your time then i'm sorry. I'll just use ldifde. Thanks again for all your help.
~ross
If this is taking too much of your time then i'm sorry. I'll just use ldifde. Thanks again for all your help.
~ross
Sorry dude, I just keep losing track.
Here's a bit of a different script that should deal with this one.
Chris
Set objOU = GetObject("LDAP://OU=Somewhere,DC=yourdomain,DC=net")
objOU.Filter = Array("user")
Dim arrNewAddresses()
For Each objUser in objOU
arrProxyAddresses = objUser.GetEx("proxyAddresses")
booHasAddress = False
ReDim arrNewAddresses(0)
j = 0
For i = 0 To UBound(arrProxyAddresses)
If InStr(1, arrProxyAddresses(i), "vm-", vbTextCompare) > 0 And _
InStr(1, arrProxyAddresses(i), "SMTP", VbTextCompare) > 0 Then
ReDim Preserve arrNewAddresses(j)
arrNewAddresses(j) = Replace(arrProxyAddresses(i), "smtp:", "SMTP:")
j = j + 1
booHasAddress = True
ElseIf InStr(1, arrProxyAddresses(i), "SMTP", VbTextCompare) = 0 Then
ReDim Preserve arrNewAddresses(j)
arrNewAddresses(j) = arrProxyAddresses(i)
j = j + 1
End If
Next
' Ensure only one address is Primary
booHasPrimary = False
For i = 0 To UBound(arrNewAddresses)
If booHasPrimary = True Then
arrNewAddresses(i) = Replace(arrNewAddresses(i), "SMTP:", "smtp:")
End If
If InStr(arrNewAddresses(i), "SMTP:") > 0 Then
booHasPrimary = True
End If
Next
If j > 0 And booHasAddress = True Then
WScript.Echo objUser.Get("name")
WScript.Echo Join(arrNewAddresses, vbCrLf)
objUser.Put "proxyAddresses", arrNewAddresses
objUser.SetInfo
End If
Next
ASKER
Thanks again!
Easy enough to do, but do bear in mind that the primary will change again unless it agrees with a recipient policy. Or did you want to turn off the attribute that allows the policy to modify it?
Chris