You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
508 B
20 lines
508 B
on error resume next
|
|
const wbemPrivilegeShutdown = 18
|
|
|
|
set locator = CreateObject("WbemScripting.SWbemLocator")
|
|
locator.security_.privileges.Add wbemPrivilegeShutdown
|
|
set service = locator.connectserver
|
|
service.security_.impersonationLevel = 3
|
|
|
|
set osset = service.instancesof ("Win32_OperatingSystem")
|
|
|
|
for each os in osset
|
|
|
|
result = os.Shutdown ()
|
|
|
|
if err <> 0 then
|
|
WScript.Echo Hex(Err.Number), Err.Description
|
|
else
|
|
WScript.Echo "Shutdown returned result " & result
|
|
end if
|
|
next
|