在MSTSC环境下使用命令实现远程统一关机

  在远程桌面的情况下,windows系统为了安全考虑开始菜单不提供关机和重启选项,那这个时候该怎么办呢?于是命令行派上了大用处:

  关机 shutdown -s -t 0 
  重启 shutdown -r -t 0

  如果需要在某个时刻关机呢,比如12点钟关机,可以使用如下命令:

  at 12:00 shutdown -s    //key "Enter"

  从上面可以看出主要使用shutdown命令,下面聊聊它的参数说明:

shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.
               Must be used with /s option.
    /e         Document the reason for an unexpected shutdown of a computer.
    /o         Go to the advanced boot options menu and restart the computer.
               Must be used with /r option.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

  除了远程应用场合,在一些其他场合使用也可以达到事半功倍的效果,简单举几个例子说明:

  1>>. 如果想在1小时后自动关闭计算机,比如:您正在下载一个软件或一部电影,而您有急事要出去,该怎么办?停止下载?太可惜了!继续?下载完后电脑怎么关闭?不用愁!可以使用该命令解决:

  shutdown –s –t 3600   (系统在3600秒后关闭计算机,时间自定)

这样就放心地出去,而不用担心计算机长期开着了。

       2>>. 出现RPC漏洞而导致倒计时自动关机,使用该命令取消倒计时自动关机:

  shutdown –a

  3>>. 有多台电脑需要统一关机处理,一台台去处理很不方便,也不合理。可以利用shutdown命令和组策略管理统一部署,快捷高效

          具体方法如下: 

       步骤1. 在“组策略编辑器”窗口的左边打开“计算机配置→Windows设置→安全设置→本地策略→用户权利指派”,在右边的窗口选择“从远端系统强制关机”。在弹出的对话框中显示目前只有“Administrators”组的成员才有权远程关机;单击对话框下方的[添加用户或组]按钮,然后在弹出的对话框中输入“远程用户账号”,再单击[确定]。 

        步骤2. 对各电脑进行上述操作后,我们便给每台计算机的““远程用户账号”户授予了远程关机的权限。 

        步骤3. 在本机上输入“Shutdown -I”,屏幕上将显示“远程关机”对话框,安装情况对远程电脑进行控制

  好了,本文就介绍到这里,更好更强大的应用方式留待大家去发掘。也可以留言共同交流

 

你可能感兴趣的:(在MSTSC环境下使用命令实现远程统一关机)