{"id":217,"date":"2017-08-13T12:20:14","date_gmt":"2017-08-13T16:20:14","guid":{"rendered":"http:\/\/puluka.com\/home\/?p=217"},"modified":"2017-08-13T12:20:14","modified_gmt":"2017-08-13T16:20:14","slug":"windows-command-line-shutdown-restart","status":"publish","type":"post","link":"http:\/\/puluka.com\/home\/techtalk\/windows-command-line-shutdown-restart\/","title":{"rendered":"Windows Command line Shutdown &#038; Restart"},"content":{"rendered":"<p>The ability to restart a computer either local or remote from the command line is useful in a variety of circumstances.<\/p>\n<ul>\n<li>When remote desktop into an XP machine only log off and disconnect are the options<\/li>\n<li>When a remote computer is unresponsive your can sometimes force a reboot.<\/li>\n<li>Using scheduled tasks and a one line batch file you can reboot in the middle of the night.\u00a0 This is especially useful on servers to minimize downtime.<\/li>\n<\/ul>\n<h2>Syntax<\/h2>\n<p>Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\\\computername] [-t xx] [-c &#8220;comment&#8221;] [-d up:xx:yy]<br \/>\nNo args\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Display this message (same as -?)<br \/>\n-i\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Display GUI interface, must be the first option<br \/>\n-l\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Log off (cannot be used with -m option)<br \/>\n-s\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Shutdown the computer<br \/>\n-r\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Shutdown and restart the computer<br \/>\n-a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Abort a system shutdown<br \/>\n-m \\\\computername\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Remote computer to shutdown\/restart\/abort<br \/>\n-t xx\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Set timeout for shutdown to xx seconds<br \/>\n-c &#8220;comment&#8221;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Shutdown comment (maximum of 127 characters)<br \/>\n-f\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Forces running applications to close without warning<br \/>\n-d [u][p]:xx:yy\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The reason code for the shutdown<br \/>\nu is the user code<br \/>\np is a planned shutdown code<br \/>\nxx is the major reason code (positive integer less than 256)<br \/>\nyy is the minor reason code (positive integer less than 65536)<\/p>\n<h2>Samples<\/h2>\n<p>Shutdown -r -t 0<br \/>\nRestart the current computer now (that is zero and in no seconds delay for time).\u00a0 Place this command into a batch file and put it in a scripts folder on servers.\u00a0 Then create a scheduled \u201cone-time\u201d task that can be configured as needed to reboot at a desired time.<\/p>\n<p>Shutdown -r -m \\\\computername -t 10 -f<br \/>\nRestart a remote computer called computername in 10 seconds.\u00a0 This displays are dialog warning and countdown.\u00a0 Or you could just go with the zero.\u00a0\u00a0 The -f forces the restart because the reason you probably need this is the computer is not responding the remote desktop or other attempts at access.<\/p>\n<p>Shutdown -i<br \/>\nGives you a dialog box to select remote or local computer and configure all the options as needed.\u00a0 This includes the ability to search for computers in AD by name.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ability to restart a computer either local or remote from the command line is useful in a variety of circumstances. When remote desktop into an XP machine only log off and disconnect are the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-techtalk"],"_links":{"self":[{"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":1,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":218,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/posts\/217\/revisions\/218"}],"wp:attachment":[{"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/puluka.com\/home\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}