I'm trying to process files that are placed in a mapped network folder. Once
a file is copied into the folder, I would like to check the filename against
a list of known files, move it, rename it and process it.
I was trying to get this example to work for me:
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
But the objLatestEvent.TargetInstancePartComponent seems to be a string
rather than an object. In other words, I can't do
objLatestEvent.TargetInstance.PartComponent.Name , etc...
Any ideas?
TIA,
Chester