我想知道是否有可能closures一个Windows Server 2003中,而不必通过远程桌面login到计算机。
服务器在我的networking上,我知道IP地址和主机名,以及pipe理员密码。
我想通过简单地双击快捷方式或执行脚本来closures。
我如何做到这一点?
远程关机…
shutdown / s / f / t 30 / m \\ SERVER-NAME
psexec \\ SERVER-NAME -e -h -u SERVER-NAME \ administrator shutdown / s / f / t 30
psexec \\ SERVER-NAME -e -h -u DOMAIN-NAME \用户名shutdown / s / f / t 30
关机参数说明…
PsExec参数说明…
batch file示例,使用本地pipe理员帐户… (作为rsla.bat粘贴到记事本中)
@echoclosures REM rsla.bat - 作为本地pipe理员远程closures REM这个脚本是由Miles Erickson,7/2010撰写的免费软件。 REM需要PsExec.exe在%PATH%中可用(c:\ windows \ system32是一个选项) REM不能用于重新启动域控制器(域控制器没有本地pipe理员帐户) IF(%1)==()GOTO指令 IF(%1)==(/?)GOTO指令 psexec \\\\%1 -e -h -u%1 \\ administrator shutdown / s / f / t 30 GOTO结束 :说明 ECHO用法:rsla SERVER-NAME(您将被提示input密码) :结束
链接…
如果您不需要指定凭据,则可以使用SHUTDOWN命令。 如果您确实需要指定凭据(您的login名没有权限,或者计算机不在域中),则可以使用PSSHUTDOWN实用程序来执行此操作。
本地帐户:
cmd /k wmic /node:"targetcomputerhostname" /user:"AdministratororWhatever" os where primary=true call reboot
具有本地pipe理员权限的AD帐户:
cmd /k wmic /node:"targetcomputerhostname" /user:"DomainAccountWithAdminPrivs@fqdn" os where primary=true call reboot
这很容易作为batch file来移植。 请记住,您将需要适当的远程exceptioins。 如果psshutdown工作,这应该工作,而不需要安装任何外部软件(不要放弃SysInternals工具,Windows发誓的一件事)。
电源shell:
$cred = get-credential Domain\AdminAccount (gwmi -co %Computername% Win32_OperatingSystem -cr $cred).Shutdown()