{"id":83255,"date":"2018-07-16T11:00:05","date_gmt":"2018-07-16T18:00:05","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=83255"},"modified":"2019-02-18T09:09:53","modified_gmt":"2019-02-18T16:09:53","slug":"powertip-turn-off-the-power-to-your-computer-with-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-turn-off-the-power-to-your-computer-with-powershell\/","title":{"rendered":"PowerTip: Turn off the power to your computer with PowerShell"},"content":{"rendered":"<p><strong>Summary<\/strong>: A simple way to power off your computer by using the Windows PowerShell cmdlets.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\"><img decoding=\"async\" width=\"34\" height=\"34\" class=\"alignnone size-full wp-image-82735\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" \/><\/a> \u00a0\u00a0 Hey, Scripting Guy! I\u2019ve got a script that needs to power off a system after it\u2019s done. How can I accomplish this with PowerShell?<\/p>\n<p style=\"padding-left: 60px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\"><img decoding=\"async\" width=\"34\" height=\"34\" class=\"alignnone size-full wp-image-82745\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" \/><\/a> \u00a0\u00a0 Look no further than the <strong>Stop-Computer<\/strong> cmdlet to turn off the power! (How\u2019s THAT for a power tip?) Here are some examples:<\/p>\n<p style=\"padding-left: 120px\"><strong># Try without doing anything bad<\/strong><\/p>\n<p style=\"padding-left: 120px\"><strong>Stop-Computer -WhatIf<\/strong><\/p>\n<p style=\"padding-left: 120px\"><strong># Stop the local computer<\/strong><\/p>\n<p style=\"padding-left: 120px\"><strong>Stop-Computer<\/strong><\/p>\n<p style=\"padding-left: 120px\"><strong># Try without doing anything bad on multiple systems<\/strong><\/p>\n<p style=\"padding-left: 120px\"><b>Stop-computer -ComputerName &#8216;computer01&#8242;,&#8217;computer02&#8242;,&#8217;computer03&#8217; -whatif<\/b><\/p>\n<p style=\"padding-left: 120px\"><strong># Stop multiple systems<\/strong><\/p>\n<p style=\"padding-left: 120px\"><b>Stop-computer -ComputerName &#8216;computer01&#8242;,&#8217;computer02&#8242;,&#8217;computer03&#8217;<\/b><\/p>\n<p style=\"padding-left: 120px\"><b><\/b><\/p>\n<p style=\"padding-left: 60px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/dr_scripto.png\"><img decoding=\"async\" width=\"96\" height=\"145\" class=\"alignnone size-full wp-image-82775\" alt=\"Drawing of Dr. Scripto\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/dr_scripto.png\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve got a script that needs to power off a system after it\u2019s done. How can I accomplish this with PowerShell?<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[639],"tags":[356,3,154,45],"class_list":["post-83255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powertip","tag-powertip","tag-scripting-guy","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>I\u2019ve got a script that needs to power off a system after it\u2019s done. How can I accomplish this with PowerShell?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=83255"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83255\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=83255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=83255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=83255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}