Powershell script/commands to check DAG cluster and databases for Exchange 2010 maintenance

#### BEGIN SCRIPT ####

# Import the FailoverClusters PowerShell module.

# Needed to run the get-clustergroup command.
# Must run each time a new command shell is opened.

write-host Importing FailoverClusters module, please wait...

import-module failoverclusters


write-host 

write-host ------------------------------------------
# Lists the PAM server
write-host -nonewline PAM AND SERVERS IN MAINTENANCE...

get-databaseavailabilitygroup -status | fl name,primaryactivemanager,serversinmaintenance


write-host ------------------------------------------

# Lists server hosting the active cluster group
write-host -nonewline CLUSTER GROUP OWNER...

get-clustergroup | fl name,ownernode,state


write-host ------------------------------------------
# Lists server with active database
write-host -nonewline MOUNTED DATABASE LOCATION...

get-mailboxdatabase | fl server,name


write-host ------------------------------------------

# Lists mailbox, mailbox copy and index status
write-host -nonewline DATABASE INDEXING STATES...

get-mailboxdatabasecopystatus *\* | fl name,activedatabasecopy,*index*


write-host ------------------------------------------

# Lists cluster server replication
write-host CLUSTER HEALTH...

test-replicationhealth


write-host

write-host  
write-host ------------------------------------------
# Lists details of any queue with more than 5 messages
write-host QUEUE STATUS...

get-transportserver | get-queue | ? {$_.messagecount -gt 5}


#### END SCRIPT ####



Comments