Start SCOM Maint Mode with PowerShell

Posted On 2017-12-13 by AustinGreca
Keywords:
Tags: Powershell Scripting System Center Windows
Views: 86


Turns on Maintenance Mode for a specific computer monitored by SCOM (System Center Operations Manager).  Ensure that the OperationsManager module is available on the computer from which this script is executed.

Example script puts machine into maintenance mode for 15 minutes (adjustable by changing the $time variable).  At the time specified, the machine will come out of maintenance mode automatically.
 
Import-Module OperationsManager
$computer = "mycomputer.mydomain.com"
$time = (Get-date).AddMinutes(15)
$instance = Get-SCOMClassInstance -Name $computer -ComputerName myscommgmtserver
Start-SCOMMaintenanceMode -Instance $instance -EndTime $time -Comment "Applying updates" -Reason PlannedOther


About the Author

AustinGreca has posted a total of 1 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:23.20.165.182

Before you can post, you need to prove you are human. If you log in, this test goes away.




Code Links