Wednesday, October 10, 2007

Update E-Mail Addresses Based on Recipient Policy - msexchpoliciesexcluded checkbox

The Recipient Update Service does not update e-mail addresses automatically when the Automatically update e-mail addresses based on recipient policy check box is not selected. That attribute stops the Recipient Update Service from running against the object when this check box is not selected.
The Automatically update e-mail addresses based on recipient policy check box refers to the value of the attribute msExchPoliciesExcluded on the object. If this attribute is not set, it indicates that this check box is selected.
If this value is set to {26491CFC-9E50-4857-861B-0CB8DF22B5D7}, it indicates that the checkbox is not selected.

The Script finds whether the AD object has "The Automatically update e-mail addresses based on recipient policy" checkbox enabled.

'Script Start

Set oConfig = GetObject("LDAP://You LDAP DOMAIN")
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open ""
strQuery = "<" & oConfig.adspath & ">;(&(objectCategory=person)(objectClass=User)(homemdb=*)(!(msExchPoliciesExcluded={26491CFC-9E50-4857-861B-0CB8DF22B5D7})));name,adspath;subtree"
Set oRS = oConn.Execute(strQuery)
While Not oRS.EOF
user = oRS.Fields("name")
'user = User & " " & oRS.Fields("adspath")
wscript.echo User
User = " "
oRS.MoveNext
Wend

'Script end

1 comment:

Anonymous said...

Approvingly your article helped me truly much in my college assignment. Hats high to you send, intention look progressive for the duration of more interrelated articles soon as its anecdote of my favourite question to read.