2011年4月10日星期日

windows server 2008 使用 psshutdown 定时关机、休眠 及错误解决

最近将本本上的系统由2003升级到了2008,发现原先我用来自动关机、休眠的免费小软件 poweroff 无法使用了(不起作用)。也懒得找了,就用系统自带的指令实现吧。
首先想到的当然是 shutdown 指令, 但是它有一个致命缺陷: 无法实现定时休眠
没办法, google 了下, 原来 SysinternalsSuite 工具包中就有一个能实现定时休眠的工具: psshutdown
试用了下,效果俱佳,完全能满足的需要。 注意下面的 -v 参数
常用指令如下:
半小时候自动休眠: psshutdown -h -t 1800 -v 0
注意:
-v 参数后接一个数字, 表示出现提示信息的时间,设置为0,表示不出现提示信息。
必须指定 -v 参数, 否则会出现 "A program can't display a message on your desktop." 错误信息:

 

win2k8shutdown

 

完整使用说明:
------------------------------------------------------------------------------------------------
usage:
psshutdown -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-t [nn|h:m]] [-v nn] [-e [u|p]:xx:yy] [-m "message"] [-u Username [-p password]] [-n s] [\\computer[,computer[,...]|@file]
   -a          Abort a shutdown (only possible while countdown is in progress)
   -c          Allow the shutdown to be aborted by the interactive user
   -d          Suspend the computer
   -e          Shutdown reason code (available on Windows XP and higher).
               Specify 'u' for unplanned and 'p' for planned
               shutdown reason codes.
               xx is the major reason code (must be less than 256)
               yy is the minor reason code (must be less than 65536)
   -f          Forces running applications to close
   -h          Hibernate the computer
   -k          Poweroff the computer (reboot if poweroff is not supported)
   -l          Lock the computer
   -m          Message to display to logged on users
   -n          Specifies timeout in seconds connecting to remote computers
   -o          Logoff the console user
   -p          Specifies optional password for user name. If you omit this
               you will be prompted to enter a hidden password.
   -r          Reboot after shutdown
   -s          Shutdown without poweroff
   -t          Specifies countdown in seconds until shutdown (default is 20) or
               the time of shutdown (in 24 hour notation)
   -u          Specifies optional user name for login to remote
               computer.
   -v          Display message for the specified number of seconds before
               the shutdown. If you omit this parameter the shutdown
               notification dialog displays and specifying a value of 0
               omits the dialog.
   computer    Shutdown the computer or computers specified
   @file       Shutdown the computers listed in the file specified
Reasons defined on this computer (U = unplanned, P = planned):
Type   Major   Minor   Title
U      0       0     Other (Unplanned)
P      0       0     Other (Planned)
U      1       1     Hardware: Maintenance (Unplanned)
P      1       1     Hardware: Maintenance (Planned)
U      1       2     Hardware: Installation (Unplanned)
P      1       2     Hardware: Installation (Planned)
P      2       3     Operating System: Upgrade (Planned)
U      2       4     Operating System: Reconfiguration (Unplanned)
P      2       4     Operating System: Reconfiguration (Planned)
P      2      16     Operating System: Service pack (Planned)
U      2      17     Operating System: Hot fix (Unplanned)
P      2      17     Operating System: Hot fix (Planned)
U      2      18     Operating System: Security fix (Unplanned)
P      2      18     Operating System: Security fix (Planned)
U      4       1     Application: Maintenance (Unplanned)
P      4       1     Application: Maintenance (Planned)
P      4       2     Application: Installation (Planned)
U      4       5     Application: Unresponsive
U      4       6     Application: Unstable
U      5      19     Security issue
P      5      19     Security issue
U      5      20     Loss of network connectivity (Unplanned)
P      7       0     Legacy API shutdown
------------------------------------------------------------------------------------------------

没有评论: