Hi!
I am trying to monitor the file creation on C:\ drive.
(when a file/or folder created in any part of of entire C:\ hard drive)
This is a script from MS for the monitoring the file creation in one folder.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop
How can I do to check the folder and its subfolders from C:\ ???
Is this a good idea to run the script on the entire hard drive??
Or would it use the all the CPU and lock the computer??
Can you help me to monitor the entire C:\ and its subfolders??
Thank you very much
I am trying to monitor the file creation on C:\ drive.
(when a file/or folder created in any part of of entire C:\ hard drive)
This is a script from MS for the monitoring the file creation in one folder.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop
How can I do to check the folder and its subfolders from C:\ ???
Is this a good idea to run the script on the entire hard drive??
Or would it use the all the CPU and lock the computer??
Can you help me to monitor the entire C:\ and its subfolders??
Thank you very much