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.
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
t = checkmsgsinfolder(ofolder, objSession)
wscript.echo "No folders to process"
function checkmsgsinfolder(folder, objsession)
for each mfolder in folder.folders
wscript.echo "Sub folder found : " & mfolder.name & " : " & mfolder.ID
x = checkmsgsinfolder(mfolder, objsession)