<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.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>Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx</link><description>Guest blogger, Karl Mitschke, discusses a Windows PowerShell script to start non-running services that are set to start automatically.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3529178</link><pubDate>Sat, 27 Oct 2012 19:08:40 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3529178</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;I am in desperate need of getting this script to work. I have like 1000 servers I have to manage and I would be the hero of the century if I could get this to work. It seems to run fine with the &amp;quot;what if&amp;quot; parameter but when I remove that piece I get the error that&amp;#39;s coded into the bottom of the script that it cannot connect to the services for server1, server2, server3, etc. on my servers.txt list. Is this something on the client end? I would think if there was an issue with powershell connectivity of some sort that it would bomb out on the -what if part, but maybe without the -what if it needs to have higher rights or something? I&amp;#39;m running this as the domain admin. Any help to get this working would be greatly appreciated!!!! $50 gift card to Outback or something - ha. This would saves me hours of hell.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3529178" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3475399</link><pubDate>Fri, 13 Jan 2012 21:01:23 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3475399</guid><dc:creator>UBlniM</dc:creator><description>&lt;p&gt;would someone recommend a good PS book. &lt;/p&gt;
&lt;p&gt;thnx&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3475399" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3475078</link><pubDate>Thu, 12 Jan 2012 07:46:25 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3475078</guid><dc:creator>UBlniM</dc:creator><description>&lt;p&gt;quite useful. on my server when a service doesn&amp;#39;t start via this script like a time out or dependency the script stops. i&amp;#39;m new to PS scripting and wondering what is a way to tell the script to try again a certain amount of times if error on start then go to next invocation.&lt;/p&gt;
&lt;p&gt;maybe i could store those that don&amp;#39;t start in an array and print to screen and prompt to try again or quit. &lt;/p&gt;
&lt;p&gt;but for now, would be nice to know how to get it to not stop/exit on error&lt;/p&gt;
&lt;p&gt;thanks for the great script. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3475078" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3472617</link><pubDate>Thu, 22 Dec 2011 19:06:09 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3472617</guid><dc:creator>Karl Mitschke</dc:creator><description>&lt;p&gt;I have updated the script once again;&lt;/p&gt;
&lt;p&gt;It now properly handles an array of computers.&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3472617" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470639</link><pubDate>Tue, 13 Dec 2011 18:09:20 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470639</guid><dc:creator>Karl Mitschke</dc:creator><description>&lt;p&gt;Thanks for the feedback, Klaus;&lt;/p&gt;
&lt;p&gt;I had an error on the default line. (Line 120)&lt;/p&gt;
&lt;p&gt;I have updated the script on the repository, but there is no need to download again, the changed line is:&lt;/p&gt;
&lt;p&gt; default {Write-Error -Message &amp;quot;Error $($Verb) service &amp;#39;$($Service.DisplayName)&amp;#39; on $($Service.__SERVER). Error: $($ReturnCode[$Result]).&amp;quot;}&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470639" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470502</link><pubDate>Tue, 13 Dec 2011 09:46:19 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470502</guid><dc:creator>Klaus Schulte</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;@everybody: You have to download the script first!&lt;/p&gt;
&lt;p&gt;There is one error in the downloaded script that leads to a strange behaviour if the command to start a process eg. fails. In this case the default of the switch statement close to the bottom of the script show Write-Error &amp;quot;.... some text ... &amp;quot; but it doesn&amp;#39;t do anything! Only the surrounding try-catch-block displays an error message!&lt;/p&gt;
&lt;p&gt;The reason: the line:&lt;/p&gt;
&lt;p&gt;default { Write-Error &amp;quot;... $($ReturnCode[$Result.ReturnvValue]).&amp;quot; }&lt;/p&gt;
&lt;p&gt;tries to index into $ReturnCode with Index: &amp;quot;$Rresult.ReturnValue&amp;quot; which is impossible of course because $Result is an [int32] and a variable $ReturnValue doesn&amp;#39;t exist!&lt;/p&gt;
&lt;p&gt;One other little thing that just looked curious on first sight ... maybe just to me:&lt;/p&gt;
&lt;p&gt;I personally would prefer to surround ALL string conditions in the &amp;quot;switch ( ....State)&amp;quot; statement with double quotes! I know it is unneccessary sometimes, but imho. it looks and feels much better if it is uniformly done ... especially if syntaxhighlighting is turned on which in fact was the reason that made me wonder :-)&lt;/p&gt;
&lt;p&gt;In the ISE the one word conditions without double quotes are violet and the composed words with double quotes are brown. &amp;nbsp;That&amp;#39;s a little bit confusing on first sight!&lt;/p&gt;
&lt;p&gt;One last thing I personally prefer if I have to populate larger hash tables, as you did in the beginning with $ReturnCode ( which is a wonderful idea btw. !!! )&lt;/p&gt;
&lt;p&gt;Using here strings and ConvertFrom-StringData to build the hash table saves a lot of typing ( especially all the double quotes ) &lt;/p&gt;
&lt;p&gt;Klaus.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470502" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470476</link><pubDate>Tue, 13 Dec 2011 07:31:52 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470476</guid><dc:creator>Klaus Schulte</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;sorry 4 that! &lt;/p&gt;
&lt;p&gt;You have been absolutely right! &lt;/p&gt;
&lt;p&gt;I could have downloaded the script, too!&lt;/p&gt;
&lt;p&gt;I just have been missing the text of the script that is usually displayed on the site ... &lt;/p&gt;
&lt;p&gt;I see that we have to accept the license before we can access the script.&lt;/p&gt;
&lt;p&gt;So the script is not shown on the linked site, but we can dowbload it!&lt;/p&gt;
&lt;p&gt;My fault!&lt;/p&gt;
&lt;p&gt;And: Yes, &amp;quot;SupportsShouldProcess=True&amp;quot; is required to support the &amp;quot;-whatif&amp;quot; and &amp;quot;-confiirm&amp;quot; switches ...&lt;/p&gt;
&lt;p&gt;Klaus.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470476" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470435</link><pubDate>Mon, 12 Dec 2011 23:18:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470435</guid><dc:creator>Karl Mitschke</dc:creator><description>&lt;p&gt;I noticed that I claim I define the parameter &amp;quot;WhatIf&amp;quot; - that&amp;#39;s incorrect - I allow the SupportsShouldProcess=True to provide this functionality - OOPS :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470435" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470432</link><pubDate>Mon, 12 Dec 2011 23:10:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470432</guid><dc:creator>Karl Mitschke</dc:creator><description>&lt;p&gt;Thanks, Klaus;&lt;/p&gt;
&lt;p&gt;I have no problem finding the script when I click the link.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://gallery.technet.microsoft.com/Starts-automatic-on-remote-26ddd199"&gt;gallery.technet.microsoft.com/Starts-automatic-on-remote-26ddd199&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the awesome filter too!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470432" width="1" height="1"&gt;</description></item><item><title>re: Use a PowerShell Script to Start Non-Running Automatic Services</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/12/use-a-powershell-script-to-start-non-running-automatic-services.aspx#3470431</link><pubDate>Mon, 12 Dec 2011 23:09:13 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470431</guid><dc:creator>Karl Mitschke</dc:creator><description>&lt;p&gt;Thanks, Grant;&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t really fond of the filter either. &lt;/p&gt;
&lt;p&gt;I initially was using you version, and just don&amp;#39;t like using Where-Object if I can avoid it..&lt;/p&gt;
&lt;p&gt;I like the filter Klaus provided better :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470431" width="1" height="1"&gt;</description></item></channel></rss>