<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Stopping maintenance mode</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx</link><description>I wrote a blog post several weeks ago about putting a computer into maintenance mode using PowerShell. For some reason after posting the script there was a white space infront of one of the parameters which resulted in the health service watcher object</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Stopping maintenance mode</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#5643221</link><pubDate>Wed, 24 Oct 2007 10:27:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5643221</guid><dc:creator>Wojtek Gurgul</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was trying to run your script and I'm getting the errors like:&lt;/p&gt;
&lt;p&gt;Method invocation failed because [System.Object[]] doesn't contain a method named&lt;/p&gt;
&lt;p&gt; 'GetRelatedMonitoringObjects'.&lt;/p&gt;
&lt;p&gt;At C:\MaintenanceMode-test.ps1:24 char:56&lt;/p&gt;
&lt;p&gt;+ $healthServices = $computer.GetRelatedMonitoringObjects( &amp;lt;&amp;lt;&amp;lt;&amp;lt; $healthServiceClass)&lt;/p&gt;
&lt;p&gt;Does the script run for SCOM 2007 or MOM 2005 only? What may be a problem?&lt;/p&gt;
&lt;p&gt;Wojtek&lt;/p&gt;</description></item><item><title>Things to know about Maintenance Mode in System Center Operations Manager 2007</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#7969066</link><pubDate>Sat, 01 Mar 2008 05:45:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7969066</guid><dc:creator>SCOM/MOM</dc:creator><description>&lt;p&gt;There are many articles that talk about maintenance mode in System Center Operations Manager 2007. Topics&lt;/p&gt;</description></item><item><title>Things to know about Maintenance Mode in System Center Operations Manager 2007</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#7969113</link><pubDate>Sat, 01 Mar 2008 05:49:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7969113</guid><dc:creator>SCOM/MOM</dc:creator><description>&lt;p&gt;There are many articles that talk about maintenance mode in System Center Operations Manager 2007. Topics&lt;/p&gt;
</description></item><item><title>A Great place for SCOM scripts</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#8885387</link><pubDate>Thu, 21 Aug 2008 19:40:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8885387</guid><dc:creator>Dario IT Solutions Blog</dc:creator><description>&lt;p&gt;Check out Boris Yanushpolsky&amp;amp;#39;s blog ( &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/boris_yanushpolsky"&gt;http://blogs.msdn.com/boris_yanushpolsky&lt;/a&gt; ). Boris is an SCOM&lt;/p&gt;</description></item><item><title>re: Stopping maintenance mode</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#9034454</link><pubDate>Mon, 03 Nov 2008 21:51:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9034454</guid><dc:creator>RV</dc:creator><description>&lt;p&gt;You cannot call a method on a null-valued expression.&lt;/p&gt;
&lt;p&gt;I ran the script from its absolute path.&lt;/p&gt;
&lt;p&gt;Any help is appreciated.&lt;/p&gt;</description></item><item><title>re: Stopping maintenance mode</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#9034468</link><pubDate>Mon, 03 Nov 2008 21:54:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9034468</guid><dc:creator>RV</dc:creator><description>&lt;p&gt;$computer = get-monitoringobject -monitoringclass:$computerClass -criteria:$computerCriteria&lt;/p&gt;
&lt;p&gt;For some reason the value of $compter is Null.&lt;/p&gt;
&lt;p&gt;That is the reason it is not able to access the method to stop the maintenane mode.&lt;/p&gt;
&lt;p&gt;I have valid values for $computerClass &amp;nbsp;and also $computerCriteria but still have a &amp;nbsp;null Value being returned by get-monitoringobject &lt;/p&gt;
&lt;p&gt;RV&lt;/p&gt;</description></item><item><title>re: Stopping maintenance mode</title><link>http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/30/stoping-maintenance-mode.aspx#9124545</link><pubDate>Wed, 19 Nov 2008 18:24:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9124545</guid><dc:creator>Christopher Keyaert</dc:creator><description>&lt;p&gt;The Script for stopping maintenance mode&lt;/p&gt;
&lt;p&gt;************************************&lt;/p&gt;
&lt;p&gt;param($rootMS,$computerPrincipalName)&lt;/p&gt;
&lt;p&gt;Add-PSSnapin &amp;quot;Microsoft.EnterpriseManagement.OperationsManager.Client&amp;quot; -ErrorVariable errSnapin;&lt;/p&gt;
&lt;p&gt;Set-Location &amp;quot;OperationsManagerMonitoring::&amp;quot; -ErrorVariable errSnapin;&lt;/p&gt;
&lt;p&gt;new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin;&lt;/p&gt;
&lt;p&gt;set-location $rootMS -ErrorVariable errSnapin;&lt;/p&gt;
&lt;p&gt;$computerClass = get-monitoringclass -name:Microsoft.Windows.Computer&lt;/p&gt;
&lt;p&gt;$healthServiceClass = get-monitoringclass -name:Microsoft.SystemCenter.HealthService&lt;/p&gt;
&lt;p&gt;$healthServiceWatcherClass = get-monitoringclass -name:Microsoft.SystemCenter.HealthServiceWatcher&lt;/p&gt;
&lt;p&gt;$computerCriteria = &amp;quot;PrincipalName='&amp;quot; + $computerPrincipalName + &amp;quot;'&amp;quot;&lt;/p&gt;
&lt;p&gt;$computer = get-monitoringobject -monitoringclass:$computerClass -criteria:$computerCriteria&lt;/p&gt;
&lt;p&gt;$healthServices = $computer.GetRelatedMonitoringObjects($healthServiceClass)&lt;/p&gt;
&lt;p&gt;$healthService = $healthServices[0]&lt;/p&gt;
&lt;p&gt;$healthServiceCriteria = &amp;quot;HealthServiceName='&amp;quot; + $computerPrincipalName + &amp;quot;'&amp;quot;&lt;/p&gt;
&lt;p&gt;$healthServiceWatcher = get-monitoringobject -monitoringclass:$healthServiceWatcherClass -criteria:$healthServiceCriteria&lt;/p&gt;
&lt;p&gt;$endTime = [System.DateTime]::Now&lt;/p&gt;
&lt;p&gt;&amp;quot;Stopping &amp;quot; + $computerPrincipalName + &amp;quot; maintenance mode&amp;quot;&lt;/p&gt;
&lt;p&gt;Set-MaintenanceWindow -endTime:$endTime -monitoringObject:$computer&lt;/p&gt;
&lt;p&gt;&amp;quot;Stopping the associated health service maintenance mode&amp;quot;&lt;/p&gt;
&lt;p&gt;Set-MaintenanceWindow -endTime:$endTime -monitoringObject:$healthService&lt;/p&gt;
&lt;p&gt;&amp;quot;Stopping the associated health service watcher maintenance mode&amp;quot;&lt;/p&gt;
&lt;p&gt;Set-MaintenanceWindow -endTime:$endTime -monitoringObject:$healthServiceWatcher&lt;/p&gt;
&lt;p&gt;************************************&lt;/p&gt;
&lt;p&gt;The command&lt;/p&gt;
&lt;p&gt;*********************************&lt;/p&gt;
&lt;p&gt;C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\MaintenanceMode\StopMaintenanceMode.ps1 –rootMS: ‘localhost’ -computerPrincipalName: 'BRAMVICAP901.contoso.com'&lt;/p&gt;
&lt;p&gt;*********************************&lt;/p&gt;</description></item></channel></rss>