Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Wednesday, September 26, 2012

Determine if the Exchange Database is Mounted with PowerShell

While delivering a class at the Federal Reserve, I had the opportunity to help out with optimizing a script for use on exchange.  The script needed to check to see if the database is mounted.  The student was able to see it mounted, but could not extract the exact integer value from the data.  Below is how we did it.

Get-Counter -Counter '\MSExchange Active Manager(*)\Database Mounted' |
ForEach-Object {$_.CounterSamples} |
Select-Object -Property InstanceName, CookedValue

 


The CookedValue is what they were ultimately looking for. 0 means dismounted and 1 means mounted.

No comments: