Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Lookup Hidden Mailboxes in Exchange 5.5
I am trying to automate the following process:
Thanks!
dsSetCredentx("cn=administrator, dc=mydomain, cn=admin","topsecret", 0) Recipients = "LDAP://myserver/cn=Recipients,ou=mydomain,o=myorg" lMboxes = dsGetChldPath(Recipients, "") lReadable = strreplace(lMboxes,@tab, @CRLF) message("lMboxes",lReadable) lInVisible = "" nCount = ItemCount(lMboxes, @Tab) for i=1 to nCount sPath = ItemExtract(i, lMboxes, @tab) bIsHidden = dsGetProperty(sPath, "Hide-From-Address-Book") if bIsHidden == 1 lInVisible = ItemInsert(sPath, -1, lDeleted, @Tab) endif next lReadable = strreplace(lInVisible,@tab, @CRLF) message("Hiden Mail boxes", lReadable)Also, I just tried to find the hidden mailboxes using the search
DsFindPath(Recipients,"(Hide-From-Address-Book=@True)")This appears to work as long as you also use the credentials indicated in the previous post.
I did not try this before because the dsFindPath function will not work with "tombstoned" objects but hidden is not the same as deleted... oh duh.
Unless you modify the LDAP search filter to excluded DELETED/Tombstoned mailboxes, it will return those as well...
So, my dsFindPath code line was like:
aADSIPath = DsFindPath(sADSIPath, "(&(ObjectClass=organizationalPerson)(&(Hide-From-Address-Book=1)(!(Is-deleted=1))))")
Here is my code for anyone else who might be interested.... (you will have to modify the default values that I have put in the UDFs)
;**************************************************************************************************************************** #DefineFunction GetHiddenMailboxes() AddExtender("wwads34i.dll") ExchInfoDiaglogFormat=`WWWDLGED,6.1` ExchInfoDiaglogCaption=`Exchange Information` ExchInfoDiaglogX=059 ExchInfoDiaglogY=136 ExchInfoDiaglogWidth=202 ExchInfoDiaglogHeight=143 ExchInfoDiaglogNumControls=014 ExchInfoDiaglogProcedure=`ExchInfo` ExchInfoDiaglogFont=`DEFAULT` ExchInfoDiaglogTextColor=`DEFAULT` ExchInfoDiaglogBackground=`DEFAULT,DEFAULT` ExchInfoDiaglog001=`045,117,036,012,PUSHBUTTON,DEFAULT,"OK",1,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog002=`115,117,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog003=`101,021,054,012,EDITBOX,Server,"EXCHANGE SERVER",DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog004=`019,021,044,012,STATICTEXT,DEFAULT,"Exchange Server:",DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog005=`019,039,066,012,STATICTEXT,DEFAULT,"Exchange Organization:",DEFAULT,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog006=`019,057,044,012,STATICTEXT,DEFAULT,"Exchange Site:",DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog007=`019,075,070,012,STATICTEXT,DEFAULT,"Exchange Service Account:",DEFAULT,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog008=`019,093,044,012,STATICTEXT,DEFAULT,"Service Account Password:",DEFAULT,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog009=`101,039,052,012,EDITBOX,Org,"Organization",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog010=`101,057,050,012,EDITBOX,Site,"Site",DEFAULT,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog011=`101,075,036,012,EDITBOX,Domain,"MY Domain",DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog012=`143,075,036,012,EDITBOX,ExchSvcAcct,DEFAULT,DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog013=`137,077,006,012,STATICTEXT,DEFAULT,"\",DEFAULT,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ExchInfoDiaglog014=`101,093,048,012,EDITBOX,SvcAcctPwd,DEFAULT,DEFAULT,2,16,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("ExchInfoDiaglog") if !ButtonPushed then exit ExchSvcAcct = StrCat("cn=",ExchSvcAcct,", dc=",domain,", cn=admin") sADSIPath = "LDAP://%server%/cn=Recipients,OU=%Site%,O=""%Org%""" dsSetCredentx(ExchSvcAcct, SvcAcctPwd, 0) aADSIPath = DsFindPath(sADSIPath, "(&(ObjectClass=organizationalPerson)(&(Hide-From-Address-Book=1)(!(Is-deleted=1))))") Result = "" for i = 1 to ItemCount(aADSIPath,@TAB) name = ItemExtract(i,aADSIPath,@TAB) UID = dsGetProperty(name, "uid") FullName = dsGetProperty(name,"cn") if i == 1 Result = StrCat(UID,@TAB,FullName) else Result = StrCat(Result,@TAB,UID,@TAB,FullName) endif next Return Result #EndFunction ;**************************************************************************************************************************** #DefineFunction ValidateAccount(UID) AddExtender("wwwnt34i.dll") Server = wntGetDc("", "MY Domain", 1) UserExist = wntUserExist(server, UID) Return UserExist #EndFunction ;**************************************************************************************************************************** HiddenMailboxes = GetHiddenMailboxes() MailboxList = "" for i = 1 to ItemCount(HiddenMailboxes,@TAB) by 2 UID = ItemExtract(i,HiddenMailboxes,@TAB) UIDExist = ValidateAccount(UID) if !UIDExist MailboxList = StrCat(MailboxList,@CRLF,ItemExtract(i+1,HiddenMailboxes,@TAB)) endif next Message("Mailboxes To Delete",MailboxList)
Article ID: W15388
File Created: 2003:05:13:11:27:26
Last Updated: 2003:05:13:11:27:26