2005年08月19日 11:59:00
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!/" & strComputer & " ootcimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!/" & strComputer & " ootcimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
NextTrackback: http://tb.blog.youkuaiyun.com/TrackBack.aspx?PostId=458734
本文介绍了一种使用WMI服务批量重启Windows系统的方法。通过设置WMI服务对象并执行查询来获取操作系统实例,进而调用Reboot方法实现系统重启。
5785

被折叠的 条评论
为什么被折叠?



