How do I schedule Windows Server Reboot / Shutdown?
You can download PsShutdown from sysinternals web site.
Store file on Windows server in folder. I use folder called C:\admutils. Next open windows command prompt (Start > Run > cmd) and use windows at command to schedule reboot:
Above command will reboot system at 2am. If you want to shutdown system:
Where,
c:> at 2:00am c:\admutils\psshutdown.exe -r -f -c -t 10
Above command will reboot system at 2am. If you want to shutdown system:
c:> at 1:00am c:\admutils\psshutdown.exe -s -f -c -t 10
Where,
- -s: Shutdown windows server
- -r: Reboot windows server
- -f: Forces all running application to exit
- -c: Allow the shutdown to by cancel by user
- -t: Specifies the countdown in seconds until the shutdown
For more information read official psshutdown documentation. Read at command help by typing at /? command.
เพิ่มเติมครับ
Restart Windows Server 2003 from the command line/? | Displays the Help listing |
/i | Displays the graphical user interface (GUI); it must be the first option |
/l | Logs off the current user; it cannot be used with the /d or /m options |
/s | Shuts down the computer |
/r | Shuts down and restarts the computer |
/g | Shuts down and restarts the computer and then restarts any registered applications |
/a | Aborts system Shutdown |
/p | Turns off the local computer with no timeout or warning |
/h | Hibernates the local machine |
/e | Documents the reason for shutting down the computer |
/m | Specifies the target computer; it is used with \\computername |
/t xxx | Where xxx is the number of seconds before Shutdown |
/c “comment” | Where “comment” is the reason for the Shutdown or restart |
/f | Forces running applications to close without warning users |
/d [p|u:]xx:yy | Provides the reason for the Shutdown action: p = planned; u= unplanned; xx supplies the major reason code; yy = supplies the minor reason code |
จากการทดสอบ ผมได้เพิ่มเข้าไปใน Scheduler Task
เริ่มจาก Add Scheduler Task ขึ้นมาใหม่
จากนั้นเลือกที่เป็น command Prompt ครับ
ตั้งชื่อ และ เลือกว่าจะให้ทำงาน ทุกวันหรือว่าวันใหน
จากนั้้นเลือกเวลาที่ต้องการครับ
ทำจนเสร็จแล้วเราจึงค่อยมาแก้ไข scheduler ที่เราสร้างขึั้นมา
ในช่อง Run แก้ให้มันเรียกไฟล์ shutdown ทำงาน
"c:\windows\system32\shutdown.exe /r /f /t 10"
เป็นอันเสร็จครับ
^__^
No comments:
Post a Comment