exchange server - Active Directory VBScript Get Users shared mailbox list -
i have found few scripts online confusing , 10 pages long lol...
what im after enter userid , search ad , result im after like:
name: pavle stoj email: pavle.stoj@...
shared mailboxes pavle has access too:
- mailbox 1
- mailbox 2
- mailbox 3
i can name , email etc when shared mailbox access dont know commands run them ?
example of have far works fine me..
' check exchange attributes 'user' ' ' ' ------------------------------------------------- ' ------------------------------------------------- ' search box userid ' ---------------------- strusername = inputbox ("userid ?") ' ------------------------------------------------- ' ------------------------------------------------- ' connect ad , use userid entered ' ------------------------------------------------- set objrootdse = getobject("ldap://rootdse") strdomain = objrootdse.get("defaultnamingcontext") set objconnection = createobject("adodb.connection") objconnection.provider = "adsdsoobject" objconnection.open "active directory provider" set objcommand = createobject("adodb.command") set objcommand.activeconnection = objconnection objcommand.properties("searchscope") = 2 objcommand.commandtext = "select distinguishedname 'ldap://" & strdomain & "' objectcategory='user' , samaccountname = '" & strusername & "'" set objrecordset = objcommand.execute ' ------------------------------------------------- ' quick check user exists in ad ' ---------------------------------- if not objrecordset.eof strdistou = objrecordset.fields("distinguishedname").value else msgbox("no results for: " & strusername) wscript.quit end if ' ------------------------------------------------- set objuser = getobject("ldap://" & strdistou) strname = objuser.fullname msgbox strname
worked out...
delegatelist = objuser.get("publicdelegatesbl") each desc in delegatelist set objmailbox = getobject("ldap://" & desc) wscript.echo " " & objmailbox.displayname next
Comments
Post a Comment