A forum user asked how to get a list of servers in maintenance mode, and who put the server into maintenance mode.
To get a list of servers in maintenance mode, you can use the following PowerShell snippet:
Get-BrokerMachine | ? InMaintenanceMode -eq $True | Sort MachineName |
Select @{Name="Machine";Expression={$_.MachineName.Split('\')[1]}},
IPAddress, InMaintenanceMode
... and you can use the following snippet to see who has turned on maintenance mode in the past 30 days:
$fromDate = (Get-Date).AddDays(-30)
Get-LogHighLevelOperation -Filter{ StartTime -ge $fromDate -and Text -like "Turn On Maintenance Mode*" } |
Sort StartTime -Descending |
Select @{Name="When";Expression={$_.StartTime}},
@{Name="Who";Expression={$_.User.Split('\')[1]}},
@{Name="Server";Expression={$_.Text}}
It would be a bit challenging to attempt to match up the results of the two commands, since the first one is point in time, and the server may have gone in and out of maintenance mode multiple times during the 30-day period.
Sam Jacobs is the Director of Technology at Newtek Technology Solutions (formerly IPM, the longest standing Citrix Platinum Partner on the East Coast). With more than 40 years of IT consulting, Sam is a Citrix NetScaler, StoreFront, and Web Interface customization and integration expert. He holds Microsoft Azure Developer and Citrix CCP-N certifications, and was a frequent contributor to the CUGC CTP blog. He has presented advanced breakout sessions at Citrix Synergy for 6 years on ADC (NetScaler) and StoreFront customizations and integration. He is one of the top Citrix Support Forum contributors, and has earned industry praise for the tools he has developed to make NetScaler, StoreFront, and Web Interface easier to manage for administrators and more intuitive for end users. Sam became a Citrix Technology Professional (CTP) in 2015, and can be reached at sjacobsCTP@gmail.com.