Maintenance mode in scom using command shell
Hi,
I have a requirement that the computers needs to be placed in MM using the Operations Manager Shell. I could able to put the whole group like SQL in Maintenance mode from the shell (using New-MaintenanceWindow -path option).
1. I need to be able to put single computer in MaintenanceMode
2. Put few computers in a single maintenance window
3. Group of computer which iI have created to be in plcaed in MM.
Am not able to get the above three requirements. Any help is appreciated.
Thanks,
SaravThanks, Sarav
April 10th, 2011 11:38am
For Group =
http://blogs.technet.com/b/operationsmgr/archive/2009/11/17/putting-a-group-of-computers-into-maintenance-mode-via-powershell.aspx
Also can look at
http://blogs.technet.com/b/mgoedtel/archive/2009/10/29/updated-powershell-script-maintenance-mode.aspx
Regards,
Vik
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2011 1:11pm
Here is another option - it uses PShell scripts behind the scenes but exposes them in a more user friendly GUI.
Cheers
GrahamView OpsMgr tips and tricks at
http://systemcentersolutions.wordpress.com/
April 10th, 2011 2:41pm
Here is another option - it uses PShell scripts behind the scenes but exposes them in a more user friendly GUI.
http://www.scom2k7.com/scom-remote-maintenance-mode-scheduler-20/
Cheers
Graham
View OpsMgr tips and tricks at
http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2011 2:41pm
We already have a GUI that is being used for current MOM server, am just interested in only commands so that I can integrate the commands with our GUI.
For Example,
Is it possible to pass the computer name in the New-MaintenanceWindow command? If then its possible to pass mulitiple computers in this command.
Thanks, SaravThanks, Sarav
April 10th, 2011 3:45pm
If that is the case then Vik gives you the answer - you can't pass multiple computers to new-maintenancewindow but you can loop through a list (which effectively is what the group script does).
Cheers
GrahamView OpsMgr tips and tricks at
http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2011 4:57pm
I have created a script for maintenance (taken help from the forums)
>$mg = New-Object Microsoft.EnterpriseManagement.ManagementGroup("localhost")
>$computerMonitoringClass = $mg.GetMonitoringClass([Microsoft.EnterpriseManagement.Configuration.SystemMonitoringClass]::WindowsComputer)
>$criteria = New-Object Microsoft.EnterpriseManagement.Monitoring.MonitoringObjectCriteria($null,$computerMonitoringClass)
>$criteria.GetValidPropertyNames()
>$server = Get-MonitoringObject -MonitoringClass $mc -Criteria 'PrincipalName=xxxxxx.xxx.xx.xx'"
>> New-MaintenanceWindow -StartTime "04/10/2011 03:30 PM" -EndTime "04/10/2011 04:30
PM" -monitoringobject:$server -comment:'Testing'
After executing this, the script stops with >> , I dont think this script is working..
>>
>>
Can someone please help me to get this script corrected.
Thanks, SaravThanks, Sarav
April 11th, 2011 8:34pm
Additionally, please also refer to the scripts in the following posts:
What if I dont want to put the whole computer into maintenance mode?
http://blogs.msdn.com/b/boris_yanushpolsky/archive/2007/10/19/what-if-i-dont-want-to-put-the-whole-computer-into-maintenance-mode.aspx
Place a Group in Maintenance Mode with Powershell
http://blogs.msdn.com/b/steverac/archive/2010/08/09/place-a-group-in-maintenance-mode-with-powershell.aspx
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 12th, 2011 2:47am
Thank All. I got the script working but it looks like its taking time only in the UTC time zone. I need to modify the script to use the Local time (CST -)
Where I need to modify the script to make it to accept CST time not UTC.
Thanks, SaravThanks, Sarav
April 12th, 2011 3:26pm
Hi,
In the following document, we can see “NOTE: This value is assumed to be UTC time. If the Kind property of the supplied DateTime value is set to
"Local", this value will be converted to UTC time automatically.” in the descriptions of the parameters -StartTime<DateTime> and -EndTime<DateTime>.
New-MaintenanceWindow
http://technet.microsoft.com/en-us/library/gg132214.aspx
Meanwhile, please see if the “EXAMPLE 1” is helpful.
Thanks.Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 13th, 2011 4:01am