DantanaSwat
IS-IT--Management
It dont wanna work 
The idea
Upon a new xdb file being created in the c:\program files\Symantec Antivirus folder I want it to delete all folders in the c:\program file\symantec antivirus\I2_LDVP.VDB folder
strComputer = "virus server"
Dim objWMIService, strComputer, colMonitiredEvents, objLatestEvent, objEmail, colDataFila
Set objWMIService = GetObject("winmgmts:\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent = " _
& "'Win32_Directory.Name=""c:\\\\Program Files\\\\Symantec AntiVirus\\\\""'" _
& " and TargetInstance.PartComponent = 'CIM_DataFile.extension = ""xdb""'")
Do While True
Set objLatestEvent = colMonitoredEvents.NextEvent
WScript.Echo objLatestEvent.TargetInstance.PartComponent
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "xxx@xxx.xxx"
objEmail.To = "xxx@xxx.xxx"
objEmail.Subject = "Virus server got a file"
objEmail.Textbody = objLatestEvent.TargetInstance.PartComponent
objEmail.Send
Set colFolders = objWMIService.ExecQuery _
("SELECT * FROM Win32_Directory WHERE Name = 'c:\\Progam Files\\Symantec AntiVirus\\I2_LDVP.VDB'")
For Each objFolder in colFolders
objFolder.Delete
Next
Loop
The idea
Upon a new xdb file being created in the c:\program files\Symantec Antivirus folder I want it to delete all folders in the c:\program file\symantec antivirus\I2_LDVP.VDB folder
strComputer = "virus server"
Dim objWMIService, strComputer, colMonitiredEvents, objLatestEvent, objEmail, colDataFila
Set objWMIService = GetObject("winmgmts:\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent = " _
& "'Win32_Directory.Name=""c:\\\\Program Files\\\\Symantec AntiVirus\\\\""'" _
& " and TargetInstance.PartComponent = 'CIM_DataFile.extension = ""xdb""'")
Do While True
Set objLatestEvent = colMonitoredEvents.NextEvent
WScript.Echo objLatestEvent.TargetInstance.PartComponent
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "xxx@xxx.xxx"
objEmail.To = "xxx@xxx.xxx"
objEmail.Subject = "Virus server got a file"
objEmail.Textbody = objLatestEvent.TargetInstance.PartComponent
objEmail.Send
Set colFolders = objWMIService.ExecQuery _
("SELECT * FROM Win32_Directory WHERE Name = 'c:\\Progam Files\\Symantec AntiVirus\\I2_LDVP.VDB'")
For Each objFolder in colFolders
objFolder.Delete
Next
Loop