Check mount status of exchange 2003 mailbox database

If you have information, script, utility, or idea that can be useful for HostMonitor community, you welcome to share information in this forum.
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

Yes a separate test, this time using Active RMA of a customers remote Exchange server. The agent is running using service account that is setup in the same way as the HM account on the HM server; administrator, delegated exchange administrator, run as a service and as a batch job, etc.
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

We cannot reproduce the problem.
We will modify script for you so you will be able to use Shell Script test method and see error description in Reply field of the test

Regards
Alex
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

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

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
Regards
Alex
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

Thanks but getting a Syntax error, the paramaters I am passing are in this format:

SERVER "First Storage Group" "Mailbox Store (SERVER)"
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

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.
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Microsoft says this error can occur when StorageGroupName is incorrect or when "account that you are using is not a part of the Exchange Domain Servers administrator global group"

Regards
Alex
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

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.
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

I just configured the script to run on my server (HM local not RMA) and it works perfectly, as does the other test I have running.

It's going to be something simple that's been overlooked but for now I am not seeing what the problem is.
meppyman
Posts: 118
Joined: Sun Sep 06, 2009 1:53 am
Location: Melbourne

Post by meppyman »

Any one got any more ideas with this one? I have a client that has their store go down frequently and it's embarrassing that they know before I do even when it happens after hours.
Post Reply