WordPress.com



Set Maintenance ModeFrom the OpsMgr PowerShell plugin, run:get-monitoringclass | export-csv c:\temp\classlist.csvOpen the csv file and search on TCP .. you’ll find 3 class entries for your “monitor” (you can see the actual name of the monitor two columns along from the following 3 class entries).TCPPortCheck_GUIDTCPPortCheck_GUIDGroupTCPPortCheck_GUIDWatcherComputerGroupOnce we know the class name, we can list the instances of that class that we have:get-monitoringclass –name TCPPortCheck_GUID| get-monitoringobjectOr in my example:I can see the display name of my class which is what I want to use to put the monitor in maintenance mode Run a Maintenance Mode script$rootMS="LDNOM07R2.”$TCPMonitorName = "Check Port 80 on my webserver"$minutes="10"$comment="Mostly Harmless"$reason="PlannedOther"Add-PSSnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" -ErrorVariable errSnapin; Set-Location "OperationsManagerMonitoring::" -ErrorVariable errSnapin;new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin;set-location $rootMS -ErrorVariable errSnapin; $TCPWatcher = (Get-MonitoringClass -name TCPPortCheck_8275b8b6585747dd9cf9cb9bd878a851) | Get-MonitoringObject | where {$_.DisplayName -eq $TCPMonitorName} $startTime = [System.DateTime]::Now$endTime = $startTime.AddMinutes($minutes) foreach ($name in $TCPWatcher) {New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObject:$name -comment:$comment -Reason:$reason } ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download