Friday, October 26, 2012

[OpsMgr 2012][Orchestartor 2012] SCOM 2012 – Maintenance Mode and Orchestrator

An interesting article related to maintenance mode in System Center Operations Managers 2012 using Orchestrator.


Brut force methode used in Operations Manager 2007 (see script below) has been tested in Operations Managers 2012 and since the cmdlet has changed, only the get-date is well working...

$class = get-monitoringclass -name:Microsoft.Windows.Computer
$computer = get-monitoringobject -monitoringclass:$class -criteria:”PrincipalName=’scottmusjm1.tpb.lab’”
$start = get-date
$end = $start.addminutes(30)
new-maintenanceWindow -startTime:$start -endTime:$end -monitoringobject:$computer -comment:”Testing”

New script for Operations manager 2012 should look like (note the use of | where for the get-scomclassinstance) :

$class = get-scomclass -name:’Microsoft.Windows.Computer’
$computer = get-scomclassinstance -class $class | where{$_.name -eq ‘SCOTTMUSJM2.tpb.lab’}
$start = get-date
$end = $start.addminutes(30)
start-scommaintenancemode -Instance:$computer -EndTime:$end -Comment:”Testing”
Result looks good when you execute the line in powershell but no so much : not only does the script not set MM on the health service and the health service watcher, it doesn’t put the objects contained by Windows Computer into MM.

The rest of the article explains how to use Orchestrator to put in maintenance mode and show that all objects have been removed from MM including the health service and the health service watcher.


This posting is provided "AS IS" with no warranties.

No comments:

Post a Comment