Problem
You want to place a server in maintenance mode to prevent it from generating incorrect alerts.
Solution
To schedule a maintenance window on a computer, use the NewMaintenanceWindow cmdlet:
$computer = GetAgent | WhereObject { $_.Name match "Denver" }
$computer.HostComputer | NewMaintenanceWindow `
StartTime (GetDate) `
EndTime (GetDate).AddMinutes(5) `
Comment "Security updates"
To retrieve information about that maintenance window, use the GetMaintenanceWindow cmdlet:
>$computer.HostComputer | GetMaintenanceWindow
MonitoringObjectId : a542ffe891a284a637b00555b15513bd
StartTime : 5/22/2007 9:27:23 AM
ScheduledEndTime : 5/22/2007 9:32:23 AM
EndTime :
Reason : PlannedOther
Comments : Security updates
User : CONTOSO\Administrator
LastModified : 5/22/2007 9:27:23 AM
ManagementGroup : MMS
ManagementGroupId : 846c09747fd058f28020400f125beb67
To stop maintenance mode, use the SetMaintenanceWindow cmdlet to end the maintenance window immediately:
$computer.HostComputer | SetMaintenanceWindow EndTime (GetDate)
Discussion
For more information about the NewMaintenanceWindow cmdlet, type GetHelp NewMaintenanceWindow. For more information about the GetMaintenanceWindow cmdlet, type GetHelp GetMaintenanceWindow. For more information about the SetMaintenanceWindow cmdlet, type GetHelp SetMaintenanceWindow.