{"id":2225,"date":"2017-08-24T12:32:35","date_gmt":"2017-08-24T18:32:35","guid":{"rendered":"https:\/\/kevinjustin.com\/blog\/?p=2225"},"modified":"2024-09-10T17:40:19","modified_gmt":"2024-09-10T21:40:19","slug":"scom-maintenance-mode-powershell","status":"publish","type":"post","link":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/","title":{"rendered":"SCOM Maintenance Mode PowerShell"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2226 size-medium\" src=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png\" alt=\"\" width=\"300\" height=\"208\" srcset=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png 300w, https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-768x532.png 768w, https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1.png 802w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/p>\n<p>My thanks to Matt Taylor and Kevin Holman, Ralph Kyttle, and John Kavanagh\u00a0for their guidance!<\/p>\n<p><strong><span style=\"color: #ff0000;\">Updated 24 Jun 2022<\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Read on if these apply<\/strong><br \/>\nTrying to start, update, or end SCOM MM<\/p>\n<p>Get alerts when MM is updated<br \/>\nPowerShell only in your shop!<br \/>\nSCORCH in play but need to convert runbooks to straight PowerShell<\/p>\n<p>Ran into issues using <span style=\"color: #3366ff;\">Set-SCOMMaintenanceMode<\/span>, as the cmdlet doesn&#8217;t put ALL the recursive classes under Windows Computer<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Background<\/strong><\/p>\n<p><span style=\"color: #3366ff;\">Set-SCOMMaintenanceMode<\/span> cmdlet\u00a0is actually \u201cby design.\u201d\u00a0 \u2639<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Start-SCOMMaintenanceMode<\/span> assumes you want recursive action when you start maintenance mode\u2026.<\/p>\n<p>Pick a Windows Computer and it places the Windows Computer object (AND all contained objects) into MM.<\/p>\n<p>&nbsp;<\/p>\n<p>Computer in MM<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2265\" src=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/MMExtended1.PNG\" alt=\"\" width=\"572\" height=\"436\" \/><\/p>\n<p>All contained objects in MM<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2275\" src=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/Still-In-MM1.png\" alt=\"\" width=\"844\" height=\"562\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>However, the problem is that <span style=\"color: #3366ff;\">Set-SCOMMaintenancemode<\/span> does not have an understanding of recursiveness.<\/p>\n<p>Command\u00a0changes the MM entry for the Windows Computer, but NOT all the contained objects.\u00a0 So they retain the original setting.<\/p>\n<p>&nbsp;<\/p>\n<p>Health explorer looks like this, resulting in unwanted alerts<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2245\" src=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/WindowsComputerINMM.PNG\" alt=\"\" width=\"479\" height=\"335\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Details<\/strong><\/p>\n<p><span style=\"color: #ff0000;\">NOTE these $Time and DateTime Method are dependent on the delay between running the commands<\/span><br \/>\n<span style=\"color: #ff0000;\"> If you start MM, and wait 5 minutes, then update, the total MM duration will be ~20 minutes<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1>Maintenance Mode options and examples<\/h1>\n<p><strong># Setup variables for MM<\/strong><\/p>\n<p># Example\u00a01 Windows Computer<\/p>\n<p><span style=\"color: #3366ff;\">$server = &#8220;Servername.FQDN&#8221;<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$instance = (get-scomclass -DisplayName &#8220;Windows Computer&#8221; |Get-SCOMClassInstance | where { $_.DisplayName -eq $server } )<\/span><\/p>\n<p># Set time for 6 minutes<\/p>\n<p><span style=\"color: #3366ff;\">$Time = (Get-Date).addMinutes(6)<\/span><\/p>\n<p><span style=\"color: #3366ff;\">Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Comment &#8220;Starting Maintenance Mode.&#8221; -Reason &#8220;PlannedOther&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p># Example\u00a02<\/p>\n<p># Business needs require Windows Operating System monitoring to occur while Application is in maintenance<\/p>\n<p># My Example is Defender, could be SQL, MSMQ, Lync, Skype, or your custom class created for your application<\/p>\n<p><span style=\"color: #3366ff;\">$Class = (get-scomclass)<\/span><br \/>\n<span style=\"color: #3366ff;\">$Class | ? { $_.Name -like &#8220;*Defender*&#8221; } | fl DisplayName,Name<\/span><br \/>\n<span style=\"color: #3366ff;\">$Class | ? { $_.Name -like &#8220;*Defender*&#8221; } | fl DisplayName,Name<\/span><\/p>\n<p>DisplayName : Protected Endpoint<br \/>\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Microsoft.WindowsDefender.ProtectedServer<\/p>\n<p>DisplayName : Protected Candidate<br \/>\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Microsoft.WindowsDefender.ProtectedServerCandidate<\/p>\n<p>DisplayName : Unprotected Endpoint<br \/>\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Microsoft.WindowsDefender.UnprotectedServer<\/p>\n<p>DisplayName : Microsoft Windows Defender Class<br \/>\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Microsoft.Windows.Defender.Class<\/p>\n<p># Choose the\u00a0class needed<\/p>\n<p><span style=\"color: #3366ff;\">$server = &#8220;Servername.FQDN&#8221;<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$instance = ( $Class | ? { $_.Name -like &#8220;Microsoft.Windows.Defender*&#8221; } |Get-SCOMClassInstance | ? { $_.DisplayName -eq $server } )<\/span><\/p>\n<p><span style=\"color: #000000;\"># Verify Instance variable<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$instance<\/span><\/p>\n<p>PS C:\\Users\\scomadmin&gt; $instance<\/p>\n<p>HealthState\u00a0\u00a0\u00a0\u00a0 InMaintenanceMode\u00a0 DisplayName<br \/>\n&#8212;&#8212;&#8212;&#8211;\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u00a0 &#8212;&#8212;&#8212;&#8211;<br \/>\nSuccess\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 False\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WFM.testlab.net<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\"># Don&#8217;t forget to add time variable<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$Time = (Get-Date).addMinutes(6)<\/span><\/p>\n<p><span style=\"color: #3366ff;\"><span style=\"color: #000000;\"># Start maintenance mode<\/span> <\/span><\/p>\n<p><span style=\"color: #3366ff;\">Start-S<\/span><span style=\"color: #3366ff;\">COMMaintenanceMode -Instance $Instance -EndTime $Time -Comment &#8220;Starting Maintenance Mode.&#8221; -Reason &#8220;PlannedOther&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1>Start, Update,\u00a0End and Verify Maintenance mode syntax<\/h1>\n<p>&nbsp;<\/p>\n<h2><strong># Start MM via PoSH cmdlet<\/strong><\/h2>\n<p><span style=\"color: #3366ff;\">Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Comment &#8220;Starting Maintenance Mode.&#8221; -Reason &#8220;PlannedOther&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><strong># Start MM\u00a0using\u00a0method vs. PowerShell cmdlet<\/strong><\/h2>\n<p><span style=\"color: #ff0000;\">Note Recursive in $WCobj.ScheduleMaintenanceMode<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$windowsComment=&#8221;PlannedOther&#8221;<\/span><br \/>\n<span style=\"color: #3366ff;\">$windowReason=&#8221;PlannedOther&#8221;<\/span><br \/>\n<span style=\"color: #3366ff;\">$windowsComment=&#8221;Testing Maintenance Mode&#8221;<\/span><br \/>\n<span style=\"color: #3366ff;\">$windowDuration=15<\/span><\/p>\n<p><span style=\"color: #3366ff;\">$server= &#8220;wfm.testlab.net&#8221;<\/span><br \/>\n<span style=\"color: #3366ff;\">$instance = (get-scomclass -DisplayName &#8220;Windows Computer&#8221; |Get-SCOMClassInstance | ? { $_.DisplayName -eq $server } )<\/span><br \/>\n<span style=\"color: #3366ff;\">$instance<\/span><span style=\"color: #3366ff;\">.ScheduleMaintenanceMode([datetime]::Now.touniversaltime(),([datetime]::Now).addminutes($windowDuration).touniversaltime(), &#8220;$windowReason&#8221;, &#8220;$windowsComment&#8221; , &#8220;Recursive&#8221;)<\/span><\/p>\n<p># Drop Recursive if you don&#8217;t want it (but can&#8217;t imagine why you would!)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><strong># Update MM<\/strong><\/h2>\n<p># Make sure you&#8217;ve put object in MM<\/p>\n<p><span style=\"color: #3366ff;\">$server= &#8220;wfm.testlab.net&#8221;<\/span><br \/>\n<span style=\"color: #3366ff;\">$instance = (get-scomclass -DisplayName &#8220;Windows Computer&#8221; |Get-SCOMClassInstance | ? { $_.DisplayName -eq $server } )<\/span><\/p>\n<p># 15 minutes in the future<br \/>\n<span style=\"color: #3366ff;\">$instance.UpdateMaintenanceMode([System.datetime]::Now.touniversaltime().addminutes(15),[Microsoft.EnterpriseManagement.Monitoring.MaintenanceModeReason]::PlannedOther,[System.string]::&#8221;Adding 15 minutes to the end time.&#8221;,[Microsoft.EnterpriseManagement.Common.TraversalDepth]::Recursive);<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><strong># Stop MM<\/strong><\/h2>\n<p># Make sure you&#8217;ve put object in MM<\/p>\n<p># Immediate<br \/>\n<span style=\"color: #3366ff;\">$instance.StopMaintenanceMode([System.DateTime]::Now.ToUniversalTime());<\/span><\/p>\n<p>My thanks to <strong>Jan Nevaril <\/strong><\/p>\n<p><span style=\"color: #0000ff;\">$server.StopMaintenanceMode([System.DateTime]::Now.ToUniversalTime(),\u201cRecursive\u201d)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1><\/h1>\n<h1>Verification steps<\/h1>\n<p>&nbsp;<\/p>\n<p><strong># Verify MM<\/strong><\/p>\n<p><span style=\"color: #3366ff;\">get-scommaintenancemode -ComputerName $instance.Name|fl MonitoringObjectId,StartTime,ScheduledEndTime<\/span><\/p>\n<p><span style=\"color: #ff0000;\">NOTE This will error if you&#8217;ve stopped maintenance<\/span><\/p>\n<p>Example<\/p>\n<p>PS C:\\Users\\scomadmin&gt; get-scommaintenancemode -ComputerName $instance.Name<br \/>\nget-scommaintenancemode : The Data Access service is either not running or not yet initialized. Check the event log<br \/>\nfor more information.<br \/>\nAt line:1 char:1<br \/>\n+ get-scommaintenancemode -ComputerName $instance.Name<br \/>\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br \/>\n+ CategoryInfo\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : InvalidOperation: (Microsoft.Syste&#8230;anceModeCommand:GetSCMaintenanceModeCommand) [Get-S<br \/>\nCOMMaintenanceMode], ServiceNotRunningException<br \/>\n+ FullyQualifiedErrorId : ExecutionError,Microsoft.SystemCenter.OperationsManagerV10.Commands.GetSCMaintenanceMode<br \/>\nCommand<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong># Validate MM through\u00a0Operations Manager Event ID\u2019s 1215 and 1216 logged<\/strong><\/p>\n<p><span style=\"color: #3366ff;\">get-eventlog -LogName &#8220;Operations Manager&#8221; | ? { $_.EventID -eq 1215 -OR $_.EventID -eq 1216 } |fl EventID,TimeGenerated,Message<\/span><\/p>\n<p># Alternate command to check latest 100 events<\/p>\n<p><span style=\"color: #3366ff;\">get-eventlog -LogName &#8220;Operations Manager&#8221; -newest 100\u00a0| ? { $_.EventID -eq 1215 -OR $_.EventID -eq 1216 } |fl EventID,TimeGenerated,Message<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><b><span style=\"color: #000000; font-family: Calibri;\"># Error if object NOT in MM<\/span><\/b><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">Cannot find an overload for &#8220;UpdateMaintenanceMode&#8221; and the argument count: &#8220;1&#8221;.<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">At line:1 char:1<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">+ $WCobj.UpdateMaintenanceMode(([System.datetime]::Now).addminutes(15). &#8230;<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0\u00a0\u00a0 + CategoryInfo\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : NotSpecified: (:) [], MethodException<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0\u00a0\u00a0 + FullyQualifiedErrorId : MethodCountCouldNotFindBest<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">PS C:\\Windows\\system32&gt;<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><b><span style=\"color: #000000; font-family: Calibri;\">Testing System datetime<\/span><\/b><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">PS C:\\Windows\\system32&gt; [System.datetime]::Now.addminutes(15)<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">Thursday, August 24, 2017 9:18:04 AM<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">PS C:\\Windows\\system32&gt; ([System.datetime]::Now.addminutes(15)).touniversaltime()<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"color: #000000; font-family: Calibri;\">Thursday, August 24, 2017 2:18:16 PM<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>References<\/strong><\/p>\n<p>2012 PowerShell cmdlets <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/hh920227(v=sc.20)\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/hh920227(v=sc.20)<\/a><\/p>\n<p>2016 PowerShell cmdlets <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/operationsmanager\/?view=systemcenter-ps-2016\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/operationsmanager\/?view=systemcenter-ps-2016<\/a><\/p>\n<p>2019 PowerShell cmdlets <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/operationsmanager\/?view=systemcenter-ps-2019\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/operationsmanager\/?view=systemcenter-ps-2019<\/a><\/p>\n<p>SDK<\/p>\n<p>Ralph Kyttle Blog <a href=\"https:\/\/blogs.technet.microsoft.com\/ralphkyttle\/2014\/11\/10\/scom-2012-r2-use-powershell-to-end-an-active-maintenance-mode\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/blogs.technet.microsoft.com\/ralphkyttle\/2014\/11\/10\/scom-2012-r2-use-powershell-to-end-an-active-maintenance-mode\/<\/a><\/p>\n<p>DateTime Methods <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.datetime\">https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.datetime<\/a><\/p>\n<p>SCOM 2019 Maintenance Mode<br \/>\n<a href=\"https:\/\/docs.microsoft.com\/en-us\/system-center\/scom\/manage-maintenance-mode-overview?view=sc-om-2019\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/system-center\/scom\/manage-maintenance-mode-overview?view=sc-om-2019<\/a><\/p>\n<p>MSDN MaintenanceModeReason Method\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/developer\/bb465591(v=msdn.10)\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/developer\/bb465591(v=msdn.10)<\/a><\/p>\n<p>MSDN StopMaintenanceMode Method<\/p>\n<p>UpdateMaintenanceMode Method <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/developer\/bb424495(v=msdn.10)\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/previous-versions\/system-center\/developer\/bb424495(v=msdn.10)<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>MM deluxe custom script <a href=\"https:\/\/gist.github.com\/stegenfeldt\/b3f044aa77894ed80d82f8849a48035b\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gist.github.com\/stegenfeldt\/b3f044aa77894ed80d82f8849a48035b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My thanks to Matt Taylor and Kevin Holman, Ralph Kyttle, and John Kavanagh\u00a0for their guidance! Updated 24 Jun 2022 &nbsp; &nbsp; Read on if these apply Trying to start, update, or end SCOM MM Get alerts when MM is updated PowerShell only in your shop! SCORCH in play but need to convert runbooks to straight &hellip; <a href=\"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SCOM Maintenance Mode PowerShell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[14,218,219,231,234,291,310,342,363,364,365,369,484],"class_list":["post-2225","post","type-post","status-publish","format-standard","hentry","category-administration","tag-net","tag-maintenance","tag-maintenance-mode","tag-method","tag-mm","tag-orchestrator","tag-powershell","tag-scom","tag-scom2012r2","tag-scom2016","tag-scorch","tag-sdk","tag-windows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"My thanks to Matt Taylor and Kevin Holman, Ralph Kyttle, and John Kavanagh\u00a0for their guidance! Updated 24 Jun 2022 &nbsp; &nbsp; Read on if these apply Trying to start, update, or end SCOM MM Get alerts when MM is updated PowerShell only in your shop! SCORCH in play but need to convert runbooks to straight &hellip; Continue reading &quot;SCOM Maintenance Mode PowerShell&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Kevin Justin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-24T18:32:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-10T21:40:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png\" \/>\n<meta name=\"author\" content=\"Kevin Justin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin Justin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/\"},\"author\":{\"name\":\"Kevin Justin\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/#\\\/schema\\\/person\\\/213cdc5c6c3f2a1d9e8417c07440972d\"},\"headline\":\"SCOM Maintenance Mode PowerShell\",\"datePublished\":\"2017-08-24T18:32:35+00:00\",\"dateModified\":\"2024-09-10T21:40:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/\"},\"wordCount\":889,\"commentCount\":3,\"image\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/caution-technology-ahead-1-300x208.png\",\"keywords\":[\".net\",\"maintenance\",\"maintenance mode\",\"method\",\"mm\",\"orchestrator\",\"powershell\",\"SCOM\",\"scom2012r2\",\"scom2016\",\"scorch\",\"sdk\",\"Windows\"],\"articleSection\":[\"Administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/\",\"url\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/\",\"name\":\"SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/caution-technology-ahead-1-300x208.png\",\"datePublished\":\"2017-08-24T18:32:35+00:00\",\"dateModified\":\"2024-09-10T21:40:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/#\\\/schema\\\/person\\\/213cdc5c6c3f2a1d9e8417c07440972d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/caution-technology-ahead-1.png\",\"contentUrl\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/caution-technology-ahead-1.png\",\"width\":802,\"height\":556},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/2017\\\/08\\\/24\\\/scom-maintenance-mode-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SCOM Maintenance Mode PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/\",\"name\":\"Kevin Justin&#039;s Blog\",\"description\":\"Operational monitoring tools including System Center, Azure Monitor\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/#\\\/schema\\\/person\\\/213cdc5c6c3f2a1d9e8417c07440972d\",\"name\":\"Kevin Justin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g\",\"caption\":\"Kevin Justin\"},\"url\":\"https:\\\/\\\/kevinjustin.com\\\/blog\\\/author\\\/kejustin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/","og_locale":"en_US","og_type":"article","og_title":"SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog","og_description":"My thanks to Matt Taylor and Kevin Holman, Ralph Kyttle, and John Kavanagh\u00a0for their guidance! Updated 24 Jun 2022 &nbsp; &nbsp; Read on if these apply Trying to start, update, or end SCOM MM Get alerts when MM is updated PowerShell only in your shop! SCORCH in play but need to convert runbooks to straight &hellip; Continue reading \"SCOM Maintenance Mode PowerShell\"","og_url":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/","og_site_name":"Kevin Justin&#039;s Blog","article_published_time":"2017-08-24T18:32:35+00:00","article_modified_time":"2024-09-10T21:40:19+00:00","og_image":[{"url":"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png","type":"","width":"","height":""}],"author":"Kevin Justin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kevin Justin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#article","isPartOf":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/"},"author":{"name":"Kevin Justin","@id":"https:\/\/kevinjustin.com\/blog\/#\/schema\/person\/213cdc5c6c3f2a1d9e8417c07440972d"},"headline":"SCOM Maintenance Mode PowerShell","datePublished":"2017-08-24T18:32:35+00:00","dateModified":"2024-09-10T21:40:19+00:00","mainEntityOfPage":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/"},"wordCount":889,"commentCount":3,"image":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png","keywords":[".net","maintenance","maintenance mode","method","mm","orchestrator","powershell","SCOM","scom2012r2","scom2016","scorch","sdk","Windows"],"articleSection":["Administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/","url":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/","name":"SCOM Maintenance Mode PowerShell - Kevin Justin&#039;s Blog","isPartOf":{"@id":"https:\/\/kevinjustin.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#primaryimage"},"image":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1-300x208.png","datePublished":"2017-08-24T18:32:35+00:00","dateModified":"2024-09-10T21:40:19+00:00","author":{"@id":"https:\/\/kevinjustin.com\/blog\/#\/schema\/person\/213cdc5c6c3f2a1d9e8417c07440972d"},"breadcrumb":{"@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#primaryimage","url":"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1.png","contentUrl":"https:\/\/kevinjustin.com\/blog\/wp-content\/uploads\/2017\/08\/caution-technology-ahead-1.png","width":802,"height":556},{"@type":"BreadcrumbList","@id":"https:\/\/kevinjustin.com\/blog\/2017\/08\/24\/scom-maintenance-mode-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kevinjustin.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SCOM Maintenance Mode PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/kevinjustin.com\/blog\/#website","url":"https:\/\/kevinjustin.com\/blog\/","name":"Kevin Justin&#039;s Blog","description":"Operational monitoring tools including System Center, Azure Monitor","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kevinjustin.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kevinjustin.com\/blog\/#\/schema\/person\/213cdc5c6c3f2a1d9e8417c07440972d","name":"Kevin Justin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4c2a0d1189dd1ad7f305cf08aa9c5e2d4cc8fc26fde7ca573d3fd7e75520334e?s=96&d=mm&r=g","caption":"Kevin Justin"},"url":"https:\/\/kevinjustin.com\/blog\/author\/kejustin\/"}]}},"_links":{"self":[{"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/posts\/2225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/comments?post=2225"}],"version-history":[{"count":4,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/posts\/2225\/revisions"}],"predecessor-version":[{"id":20446,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/posts\/2225\/revisions\/20446"}],"wp:attachment":[{"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/media?parent=2225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/categories?post=2225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kevinjustin.com\/blog\/wp-json\/wp\/v2\/tags?post=2225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}