Open app in vbscript 04-09-2014, 04:46 AM
#1
I made this code
It has a mistake "if...then" but I don't no how to fix it. Plz help me!
Code:
strComputer = "."
Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set wmiEvent = wmi.ExecNotificationQuery("select * from __InstanceOperationEvent within 1 where TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Description='USB Mass Storage Device'")
While True
Set usb = wmiEvent.NextEvent()
if usb.Path_.Class = "__InstanceCreationEvent" then WScript.CreateObject("Wscript.Shell").Run "msgHello.bat",0,True
Wend