cancel
Showing results for 
Search instead for 
Did you mean: 
Rob_Wilcox1
Level 6
Partner

I needed a script like this the other day because a log file that I was reviewing contained Entry ID's that I wanted to try and tie back to folder names, or even paths.

 

The text is below.. save it as a VBSCRIPT, and it will need CDO.  Also you will need to change the Exchange Server name, and mailbox alias for your environment.

 

 

debugon=true
servername="EXCH1"
mailboxname="john1"

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "","",false,true,true,true,servername & vbLF & mailboxname
Set CdoInfoStore = objSession.GetInfoStore
Set CdoFolderRoot = CdoInfoStore.RootFolder

' Start at the very top of the information store
set oFolders = cdoFolderRoot.folders
if ofolders.count > 0 then
    for each ofolder in oFolders
        if debugon = true then
            wscript.echo "Processing : " & oFolder.Name & " : " & ofolder.ID
        end if

        t = checkmsgsinfolder(ofolder, objSession)
    next
else
    wscript.echo "No folders to process"
end if

wscript.echo ""
wscript.echo "Finished"

wscript.quit

function checkmsgsinfolder(folder, objsession)

    for each mfolder in folder.folders
        wscript.echo "Sub folder found : " & mfolder.name & " : " & mfolder.ID
        x = checkmsgsinfolder(mfolder, objsession)
    next

end function
Version history
Last update:
‎05-28-2012 04:20 AM
Updated by: