‘ Mit VBScript Computer abmelden, herunterfahren oder neustarten

strComputer = “.”

Const LOGOFF = 0 ‘ Konstante für ambelden
Const SHUTDOWN = 1 ‘ Konstante für herunterfahren
Const REBOOT = 2 ‘ Konstante für neustarten
Const POWEROFF = 8

Const FORCE = 4 ‘ auf jeden Fall Aktion durchführen

flags = LOGOFF + FORCE

Set objwmi = GetObject(“winmgmts:” & “{(Shutdown)}!\\” & strComputer)

wql = “Select * from Win32_OperatingSystem”

Set colOperatingSystems = objwmi.ExecQuery(wql)

For Each objOperatingSystem In colOperatingSystems
objOperatingSystem.Win32Shutdown flags, 0 ‘ Computer abmelden, herunterfahren oder neustarten
Next


Leave a Comment


You must log in to post a comment.