Forum Discussion
SteveCox
Oct 11, 2021Brass Contributor
Automation of Exchange server Patching
Hi I am trying to setup a Script to automate patching of Exchange 2016 servers and I need to get the script to check if any if the other exchange server is in Maintenance Mode before continuing to pl...
Oct 11, 2021
You could do like this
$Maint = Get-DatabaseAvailabilityGroup -status
If ($Maint.ServersInMaintenance.count -eq 0 ) { Write-Host "No Servers in Maintenance Mode"}
This if you only have one DAG.
If you have more than one you will need to iterate between them
$Maint = Get-DatabaseAvailabilityGroup -status
If ($Maint.ServersInMaintenance.count -eq 0 ) { Write-Host "No Servers in Maintenance Mode"}
This if you only have one DAG.
If you have more than one you will need to iterate between them