KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Exchange 2007 Database state check

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
42long



Joined: 20 May 2010
Posts: 1

PostPosted: Thu May 20, 2010 3:01 am    Post subject: Exchange 2007 Database state check Reply with quote

Hi
can someone please tell me if there is a test that i can do to check exchange 2007 database stae (mount or dismount) ?
is there any test that can do this ?
thanks
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Thu May 20, 2010 12:21 pm    Post subject: Reply with quote

I think you may use Shell Script test method and script like the following
Code:
$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"

dd-PSSnapin Microsoft.Exchange.*
$mounted = (Get-MailboxDatabase -Identity $args[0] -status).Mounted
if($mounted)
{echo  $statusOk}
else
{echo  $statusBad}

Command to start script: powershell.exe %script% %params%
Parameters: just 1 parameter that should specify hostname and database name, e.g. servername\databasename

More information about Shell Script test method
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#chkShell

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
esirignano



Joined: 23 Mar 2010
Posts: 7

PostPosted: Mon Mar 26, 2012 2:45 pm    Post subject: Reply with quote

I know this topic is old but I am having trouble getting this test to work. Test status returns as bad but I know 100% the info store is mounted.



Params:

MyCompany/Engineering Database




Start cmd:

powershell.exe %script% %params%




Script:

$statusOk = "ScriptRes:Ok:"
$statusBad = "ScriptRes:Bad:"

Add-PSSnapin Microsoft.Exchange.*
$mounted = (Get-MailboxDatabase -Identity $args[0] -status).Mounted
if($mounted)
{echo $statusOk}
else
{echo $statusBad}



Any Ideas? This is running against Exchange 2007.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Mar 26, 2012 2:56 pm    Post subject: Reply with quote

How exactly did you set param ?
Parameter like MyCompany/Engineering Database will be interpreted as two "MyCompany/Engineering" and "Database"
You should use quotes for parameter like:
'MyCompany/Engineering Database'
Back to top
View user's profile Send private message Send e-mail Visit poster's website
esirignano



Joined: 23 Mar 2010
Posts: 7

PostPosted: Mon Mar 26, 2012 2:58 pm    Post subject: Reply with quote

I've tried:

MyCompany/Engineering Database
'MyCompany/Engineering Database'
"MyCompany/Engineering Database"

All return the same results.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Mar 26, 2012 3:28 pm    Post subject: Reply with quote

1. Please use backslash ( \ ) instead of slash ( / ) for database path, like 'MyCompany\Engineering Database'
2. If ShellScript runs on local server (where Exchange is located) you may try to use just database name like 'Engineering Database'

If Scrip still doesn't work, try the following:
1. Start powershell.exe
2. run command Add-PSSnapin Microsoft.Exchange.*
3. run command Get-MailboxDatabase
4. Can you see your databases after Get-MailboxDatabase was executed ?
5. Do you see any error messages after these commands ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
esirignano



Joined: 23 Mar 2010
Posts: 7

PostPosted: Mon Mar 26, 2012 3:32 pm    Post subject: Reply with quote

KS-Soft Europe wrote:
1. Please use backslash ( \ ) instead of slash ( / ) for database path, like 'MyCompany\Engineering Database'
2. If ShellScript runs on local server (where Exchange is located) you may try to use just database name like 'Engineering Database'

If Scrip still doesn't work, try the following:
1. Start powershell.exe
2. run command Add-PSSnapin Microsoft.Exchange.*
3. run command Get-MailboxDatabase
4. Can you see your databases after Get-MailboxDatabase was executed ?
5. Do you see any error messages after these commands ?



1. I'm sorry, I was originally using a backslash ( \ ).
2. It does run locally, I tried to use just 'Engineering Database', same result.

I can see the databases using your instructions, no errors.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Mar 26, 2012 3:48 pm    Post subject: Reply with quote

What HostMonitor version do you use ?
What Windows do you use ? Service Pack ? x86, x64 ?

Also, I noticed mistake in script of second post.
there should be:
Add-PSSnapin Microsoft.Exchange.*
instead of:
dd-PSSnapin Microsoft.Exchange.*

Please check if you are using right command: Add-PSSnapin Microsoft.Exchange.*

Also, you may check if database name is correct using powershell.exe with the following commandlets:
1. Add-PSSnapin Microsoft.Exchange.*
2. Get-MailboxDatabase -Identity 'MyCompany/Engineering Database'
Back to top
View user's profile Send private message Send e-mail Visit poster's website
esirignano



Joined: 23 Mar 2010
Posts: 7

PostPosted: Mon Mar 26, 2012 4:03 pm    Post subject: Reply with quote

8.86
Windows 2008 Server Enterprise x64 Edition Service Pack 2

My script has the correct "Add-PSSnapin Microsoft.Exchange.*". I did notice that error when I first came across this script.


PS C:\Users\administrator> Add-PSSnapin Microsoft.Exchange.*
PS C:\Users\administrator>
PS C:\Users\administrator> Get-MailboxDatabase -Identity 'Engineering Databa
se'

Name Server StorageGroup Recovery
---- ------ ------------ --------
Engineering Database EXCHANGE Engineering Stora... False
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Mar 26, 2012 4:21 pm    Post subject: Reply with quote

Looks like problem is related to different powershell versions x86 and x64.
You start powershell 64 bit version, while HostMonitor calls 32 bit.

Could you please copy x64 powershell.exe from default location (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
to some other location (path should not include word "powershell") E.g. c:\win64tools\powershell.exe
Then specify it in "start CMD" of ShellScript test, like:
c:\win64tools\powershell.exe %Script% %Params%
instead of
powershell.exe %script% %params%

This will make HostMonitor use 64 bit powershell.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
esirignano



Joined: 23 Mar 2010
Posts: 7

PostPosted: Tue Mar 27, 2012 8:18 am    Post subject: Reply with quote

That did it, it is now working. Really appreciate your help with this issue.

Here are my final test settings.

Params: 'Engineering Database'

Start CMD: C:\SYSTEMTOOLS\powershell.exe %script% %params%

Script:
Code:

$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"

Add-PSSnapin Microsoft.Exchange.*
$mounted = (Get-MailboxDatabase -Identity $args[0] -status).Mounted
if($mounted)
{echo  $statusOk}
else
{echo  $statusBad}
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue Mar 27, 2012 8:21 am    Post subject: Reply with quote

Quote:
That did it, it is now working.

Great
Quote:
Really appreciate your help with this issue.

You are welcome.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index