Hvornår virker Win32_ComputerShutdownEvent
Hvordan virker dette, eller rettere hvornår..?Jeg ønsker at køre et script når jeg lukker min pc ned..
On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems
strComputer = "."
UserName = ""
Password = ""
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerShutdownEvent",,48)
For Each objItem in colItems
WScript.Echo "MachineName: " & objItem.MachineName
for each propValue in objItem.SECURITY_DESCRIPTOR
WScript.Echo "SECURITY_DESCRIPTOR: " & propValue
next
WScript.Echo "TIME_CREATED: " & objItem.TIME_CREATED
WScript.Echo "Type: " & objItem.Type
Next