{"id":902,"date":"2012-11-14T11:36:19","date_gmt":"2012-11-14T16:36:19","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=902"},"modified":"2019-09-04T19:57:39","modified_gmt":"2019-09-05T00:57:39","slug":"script-to-power-down-many-windows-servers","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=902","title":{"rendered":"Script to power down many Windows servers"},"content":{"rendered":"<div style=\"float: left;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 234;\ngoogle_ad_height = 60;\ngoogle_ad_format = \"234x60_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>If you ever have the need to power down hundreds of Windows servers, then here is a script to do just that.  This script will work for Windows 2000, 2003 and 2008.  The servers will shut down gracefully.<\/p>\n<blockquote><p>for \/F %%a in (names.txt) do call:Sub %%a<br \/>\ngoto:eof<\/p>\n<p>:Sub<br \/>\necho Shutting Down %1<br \/>\n#shutdown -m \\\\%1 -s -c \u201cShut Down For Scheduled Power Outage\u201d<\/p><\/blockquote>\n<p>The names.txt file contains the names of all servers.<\/p>\n<p>After you shut down the servers you will need a script to verify.  You can try to ping each sever manually or simply run this script.<\/p>\n<blockquote><p>del pingtest-log.txt<br \/>\nSetLocal EnableDelayedExpansion<br \/>\nFOR \/F %%1 in (names.txt) do<br \/>\n(<br \/>\nping.exe -n 1 -w 100 %%1<br \/>\nIF !ERRORLEVEL! == 0 echo %%1 is ON>> pingtest-log.txt<br \/>\nIF !ERRORLEVEL! == 1 echo %%1 is OFF>> pingtest-log.txt<br \/>\n)<br \/>\nEndLocal<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>If you ever have the need to power down hundreds of Windows servers, then here is a script to do just that. This script will work for Windows 2000, 2003 and 2008. The servers will shut down gracefully. for \/F&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=902\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[25],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/902"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=902"}],"version-history":[{"count":1,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/902\/revisions"}],"predecessor-version":[{"id":903,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/902\/revisions\/903"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=902"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}