Recently I ran across an issue that it seems lots of folks have, hidden user mailboxes on Microsoft Exchange. Imagine my surprise when I got that call, “We have hidden users on a server! We must be relaying Spam or something!!” Not knowing more at that moment, I got a little nervous, as I was the idiot who installed the server. Can you see me with an idiot hat on?
I soon discovered that hidden users were apparently hidden mailboxes. Using Exchange System Manager (ESM), I too looked at the stores in question, and they did appear empty. However, when I tried to delete them, it stated that there were mailboxes on the store and that I need to move them prior to deletion. This was what started the hidden user thing.
Without going into the details of when and how Exchange creates boxes, heres a VBS script that you can run that identifies these boxes.
-
‘Shows anything that is mail enabled, but doesn’t have a mailbox
-
Dim rootDSE, domainObject, conn, cmd
-
Set rootDSE=GetObject("LDAP://RootDSE")
-
DomainContainer = rootDSE.Get("defaultNamingContext")
-
Set fs = CreateObject ("Scripting.FileSystemObject")
-
strDate = Year(Now) & "-" & Right("0" & Month(Now),2) & "-" & Right("0" & Day(Now),2)
-
Set userFile = fs.CreateTextFile ("test_" & strDate & ".csv")
-
Set conn = CreateObject("ADODB.Connection")
-
conn.Open "Provider=ADsDSOObject;"
-
Set cmd = CreateObject("ADODB.command")
-
cmd.ActiveConnection = conn
-
cmd.Properties("Cache Results") = False
-
cmd.Properties("Page Size") = 5000
-
cmd.CommandText = "<ldap:>;(&(mail=*)(msExchHomeServerName=*)(!(homeMDB=*)));adspath;subtree"
-
Set rs = cmd.Execute
-
userFile.Write "displayName,CN,mail"
-
userFile.WriteLine ""
-
While Not rs.EOF
-
Set oUser = GetObject (rs.Fields(0).Value)
-
userFile.Write chr(34) & oUser.cn & chr(34) & "," & chr(34) & oUser.givenName & " " & oUser.sn & chr(34) & "," & oUser.mail & ",smtp:" & oUser.mail
-
userFile.WriteLine ""
-
rs.MoveNext
-
Wend
The fix once you identify these users is to either remove all Exchange attributes or move the nonexistent mailbox to another Exchange server. If they aren’t using it, why waste a license.
No comment yet