Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Simple script to list entry ID's

Created: 28 May 2012 • Updated: 08 Jun 2012
Rob.Wilcox's picture
0 0 Votes
Login to vote

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