A while ago I posted this script on OutlookExchange that uses Exoledb to find unused mailboxes on a Exchange 2000 server by looking at the unread mail count in the inbox for the last 50 days. Since then I've have a few questions for people wanting to know if they could do this also in Exchange 5.5 mainly to assist in migrations and cleanups. The answer is yes you can but not with Exoledb which is only available on Exchange 2000 and up, what you can use is CDO 1.2 to do something similar.
Another good thing about using CDO 1.2 to do this is you can go a bit further then I did with the simple Exoledb sample by using some of CDO 's cool little built in methods. This is an example of a CDO script that will display the received time of the newest email in the inbox, the sent time of the last mail sent from this mailbox and the unread count for the last 50 days. It logs on to a mailbox using a dynamic profile you supply the alias name as a command line parameter and you need to hardcode the servername in the script.
accountname = WScript.Arguments(0)
set objSession = CreateObject("MAPI.Session")
strProfile = "yourserver" & vbLf & accountname
set objFolder1 = objSession.Inbox
set objMsgs1 = objFolder1.Messages
set objMsg1 = objMsgs1.Getlast
set objFolder = objSession.GetDefaultFolder(3)
set objMsgs = objFolder.Messages
set objMsg = objMsgs.Getlast
if objMsg1 is nothing then
wscript.echo "Last Recieved" & "," & accountname & "," & "No Messages"
wscript.echo "Last Recieved" & "," & accountname & "," & objMsg1.TimeSent
if objMsg is nothing then
wscript.echo "Last Sent" & "," & accountname & "," & "No Messages"
wscript.echo "Last Sent" & "," & accountname & "," & objMsg.TimeSent
objFolder1.Messages.Filter.Unread = False
set objMsgFilter = objMsgs1.Filter
objMsgFilter.Unread = True
objMsgFilter.TimeFirst = now()-50
wscript.echo "Number of Unread" & "," & accountname & "," & objMsgs1.count