Check mount status of exchange 2003 mailbox database
There is sample script that you may use with Shell Script test method, so you should see error description (not just errorlevel code)
Required params: Servername StorageGroupName MDBName
Regards
Alex
Required params: Servername StorageGroupName MDBName
Code: Select all
Option Explicit
On Error Resume Next
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
dim quot, iServer, iMDB, Args, CorrectSyntax, strMode, strComputerName, strSGName, strMDBName, strTemp, arrStGroup, strMDBUrl, i
quot = chr(34)
Set iServer = CreateObject ("CDOEXM.ExchangeServer")
Set iMDB = CreateObject ("CDOEXM.MailboxStoreDB")
Set Args = WScript.Arguments
If Args.count = 3 Then
CorrectSyntax = True
strComputerName = Args(0)
strSGName = Args(1)
strMDBName = Args(2)
Else
CorrectSyntax = False
End If
If CorrectSyntax Then
' Bind to the Exchange Server
iServer.DataSource.Open strComputerName
If Err <> 0 Then
WScript.StdOut.Write statusUnknown & Err.Description
' Cleanup
Set iServer = Nothing
Set iMDB = Nothing
WScript.Quit
End If
strTemp = "LDAP://" & iServer.DirectoryServer & "/" & "cn=" & strMDBName & ","
' Set variant array to the ExchangeServer.StorageGroups
arrStGroup = iServer.StorageGroups
' Look in the StorageGroups array if the StorageGroup with strSGName exists
If strSGName = "" Then
' Add last part to the URL to the MailboxStoreDB
strMDBUrl = strTemp & iServer.StorageGroups(0)
Else
For i = 0 To UBound(arrStGroup)
If InStr(1, UCase(arrStGroup(i)), UCase(strSGName)) <> 0 Then
strMDBUrl = arrStGroup(i)
End If
Next
If strMDBUrl <> "" Then
' Add last part to the URL to the MailboxStoreDB
strMDBUrl = strTemp & strMDBUrl
End If
End If
' Bind to the MailboxStoreDB
iMDB.DataSource.Open strMDBUrl ', , , adCreateOverwrite
If Err <> 0 Then
WScript.StdOut.Write statusUnknown & Err.Description
' Cleanup
Set iServer = Nothing
Set iMDB = Nothing
WScript.Quit
End If
dim sStoreStatus
If iMDB.Status = 0 Then
WScript.StdOut.Write statusOk & "Mounted" & " (" & strSGName & "/" & strMDBName & ")"
ElseIf iMDB.Status = 1 Then
WScript.StdOut.Write statusBad & "Dismounted" & " (" & strSGName & "/" & strMDBName & ")"
ElseIf iMDB.Status = 2 Then
WScript.StdOut.Write statusUnknown & "Store is mounting" & " (" & strSGName & "/" & strMDBName & ")"
ElseIf iMDB.Status = 3 Then
WScript.StdOut.Write statusUnknown & "Store is dismounting" & " (" & strSGName & "/" & strMDBName & ")"
Else
WScript.StdOut.Write statusUnknown & "Unknown Status" & " (" & strSGName & "/" & strMDBName & ")"
End If
' Cleanup
Set iServer = Nothing
Set iMDB = Nothing
Else
WScript.StdOut.Write statusUnknown & "Incorrect syntax. Required params: Servername StorageGroupName MDBName"
End If
Alex
Strange... all of a sudden it is returning:
"An invalid ADSI pathname was passed" (Typing this reminded me that Copy Reply never works for me).
I tried a different server with the same results.
I also mail enabled the service account just in case and made it a Full Exchange Administrator. No difference to either test.
"An invalid ADSI pathname was passed" (Typing this reminded me that Copy Reply never works for me).
I tried a different server with the same results.
I also mail enabled the service account just in case and made it a Full Exchange Administrator. No difference to either test.
The parameters are used locally with no problems from the same account as the RMA service is running under. The server is of course a member of that group as it is an SBS server. Only computer accounts get added to that group not users, users are delegated admin rights through the exchange admin tool.