' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux,
' Missy Koslosky, and Devin Ganger. Redistributed with permission
' of the publisher, O'Reilly & Associates.
' This code lists the delegates, if any, for the selected
' mailbox.
' ------ SCRIPT CONFIGURATION ------
strDCName = "<serverName>" ' e.g. "batman"
strUserName = "/cn=<userName>,<container>,<domainDN>"
' e.g. "/cn=David P. Robichaux, CN=Users, dc=robichaux, dc=net" ' ------ END CONFIGURATION ---------
' find the target user
strQuery = "LDAP://" & strDCName & strUserName
Set theUser = GetObject(strQuery)
WScript.echo "Mailbox " & strUserName
On Error Resume Next
delegateList = theUser.Get("publicDelegates")
If Err.Number <> -2147463155 Then
wscript.echo "has these delegates:"
For Each Desc In delegateList
WScript.Echo " " & desc
Next
Else
WScript.Echo "+ Has no delegates"
End If
delegateList = theUser.Get("publicDelegatesBL")
If Err.Number <> -2147463155 Then
wscript.echo "+ is a delegate of"
For Each Desc In delegateList
WScript.Echo " " & desc
Next
Else
WScript.Echo "+ Not a delegate for anyone"
End If
|