使用WMI重启不能用3389登录的服务器

    远程重启动服务器的VBscript,其实重起的办法也有很多,比如用SQL的查询分析器等。

strComputer  =   " 192.168.0.1"
strUsername = " ABC"
strPassword = " EFG"

Set  objLocator  =   CreateObject ( " WbemScripting.SWbemLocator " )
Set  objWMIService  =  objLocator.ConnectServer(strComputer , " \root\cimv2 " , strUsername ,strPassword)
objWMIService.Security_.ImpersonationLevel 
=   3  

Set  colOperatingSystems  =  objWMIService.ExecQuery ( " Select * from Win32_OperatingSystem " )
For   Each  objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Reboot()
Next

你可能感兴趣的:(服务器)