Advertisement
itnetsec

Shutdown/Restart a Windows machine remotely

Nov 30th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. #Written by: Michael Wood
  2. #Date 11-30-2011
  3.  
  4. Open a command prompt window
  5. Start > Run > cmd
  6.  
  7. The command below will restart the remote machine. Replace \\computername with a physical machine name on your network
  8. shutdown -m \\computername /r
  9.  
  10. The command below will shutdown (halt) the remote machine. Replace \\computername with a physical machine name on your network
  11. shutdown -m \\computername /s
  12.  
  13. The command below will logoff the current user on the remote machine. Replace \\computername with a physical machine name on your network
  14. shutdown -m \\computername /l
  15.  
  16. By default, the shutdown command for a restart or shutdown is 30 seconds. You can have the remote machine restart or shutdown immediately by running one of these commands:
  17. shutdown -m \\computername /r /t 0 <---this will restart the remote machine immediately
  18. shutdown -m \\computername /s /t 0 <---this will shutdown (halt) the remote machine immediately
  19.  
  20.  
  21. Here are some other cool features you can play around with:
  22. Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
  23. [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
  24.  
  25. No args Display help. This is the same as typing /?.
  26. /? Display help. This is the same as not typing any options.
  27. /i Display the graphical user interface (GUI).
  28. This must be the first option.
  29. /l Log off. This cannot be used with /m or /d options.
  30. /s Shutdown the computer.
  31. /r Shutdown and restart the computer.
  32. /g Shutdown and restart the computer. After the system is
  33. rebooted, restart any registered applications.
  34. /a Abort a system shutdown.
  35. This can only be used during the time-out period.
  36. /p Turn off the local computer with no time-out or warning.
  37. Can be used with /d and /f options.
  38. /h Hibernate the local computer.
  39. Can be used with the /f option.
  40. /e Document the reason for an unexpected shutdown of a computer.
  41. /m \\computer Specify the target computer.
  42. /t xxx Set the time-out period before shutdown to xxx seconds.
  43. The valid range is 0-315360000 (10 years), with a default of 30
  44. If the timeout period is greater than 0, the /f parameter is
  45. implied.
  46. /c "comment" Comment on the reason for the restart or shutdown.
  47. Maximum of 512 characters allowed.
  48. /f Force running applications to close without forewarning users.
  49. The /f parameter is implied when a value greater than 0 is
  50. specified for the /t parameter.
  51. /d [p|u:]xx:yy Provide the reason for the restart or shutdown.
  52. p indicates that the restart or shutdown is planned.
  53. u indicates that the reason is user defined.
  54. If neither p nor u is specified the restart or shutdown is
  55. unplanned.
  56. xx is the major reason number (positive integer less than 256)
  57. yy is the minor reason number (positive integer less than 6553
  58.  
  59.  
  60. Reasons on this computer:
  61. (E = Expected U = Unexpected P = planned, C = customer defined)
  62. Type Major Minor Title
  63.  
  64. U 0 0 Other (Unplanned)
  65. E 0 0 Other (Unplanned)
  66. E P 0 0 Other (Planned)
  67. U 0 5 Other Failure: System Unresponsive
  68. E 1 1 Hardware: Maintenance (Unplanned)
  69. E P 1 1 Hardware: Maintenance (Planned)
  70. E 1 2 Hardware: Installation (Unplanned)
  71. E P 1 2 Hardware: Installation (Planned)
  72. E 2 2 Operating System: Recovery (Planned)
  73. E P 2 2 Operating System: Recovery (Planned)
  74. P 2 3 Operating System: Upgrade (Planned)
  75. E 2 4 Operating System: Reconfiguration (Unplanned)
  76. E P 2 4 Operating System: Reconfiguration (Planned)
  77. P 2 16 Operating System: Service pack (Planned)
  78. 2 17 Operating System: Hot fix (Unplanned)
  79. P 2 17 Operating System: Hot fix (Planned)
  80. 2 18 Operating System: Security fix (Unplanned)
  81. P 2 18 Operating System: Security fix (Planned)
  82. E 4 1 Application: Maintenance (Unplanned)
  83. E P 4 1 Application: Maintenance (Planned)
  84. E P 4 2 Application: Installation (Planned)
  85. E 4 5 Application: Unresponsive
  86. E 4 6 Application: Unstable
  87. U 5 15 System Failure: Stop error
  88. U 5 19 Security issue
  89. E 5 19 Security issue
  90. E P 5 19 Security issue
  91. E 5 20 Loss of network connectivity (Unplanned)
  92. U 6 11 Power Failure: Cord Unplugged
  93. U 6 12 Power Failure: Environment
  94. P 7 0 Legacy API shutdown
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement