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

在Windows Server 2008上,作者发现poweroff软件不再适用,转而使用系统内置的psshutdown工具实现定时关机和休眠功能。psshutdown可以避免shutdown命令的限制,例如定时休眠。文章详细介绍了psshutdown的使用方法,包括参数解释和示例,如使用-p参数实现定时休眠,-v参数消除错误提示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近将本本上的系统由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
------------------------------------------------------------------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值