From: Leon on
Hi

it seem there are only two events responding to wmi
InstanceOperationEvent.
namely creation and deletion

nevertheless I see there are a modified also

What am I missing?

I tried this...

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 0.1 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""C:\\\\temp\\\
\myfolder""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
msgbox "event is " & objLatestEvent.path_.class
loop

Cheers
From: Leon on
I see I'm a little unclear
What I mean is i have read ther are a event to be captured when files
are modified.
That should be included in InstanceOperationEvent - but it does not
work.
Only 2 events are comming up - creation and deletion

On 4 Aug., 16:00, Leon <kim.zeth...(a)gmail.com> wrote:
> Hi
>
> it seem there are only two events responding to wmi
> InstanceOperationEvent.
> namely creation and deletion
>
> nevertheless I see there are a modified also
>
> What am I missing?
>
> I tried this...
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
>     & "{impersonationLevel=impersonate}!\\" & _
>         strComputer & "\root\cimv2")
>     Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
>     ("SELECT * FROM __InstanceOperationEvent WITHIN 0.1 WHERE " _
>         & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
>             & "TargetInstance.GroupComponent= " _
>                 & "'Win32_Directory.Name=""C:\\\\temp\\\
> \myfolder""'")
> Do
>     Set objLatestEvent = colMonitoredEvents.NextEvent
>     msgbox "event is " & objLatestEvent.path_.class
>  loop
>
> Cheers

From: Pegasus [MVP] on


"Leon" <kim.zethsen(a)gmail.com> wrote in message
news:100c670e-7695-4fce-8711-01daeace4d69(a)m1g2000yqo.googlegroups.com...
> Hi
>
> it seem there are only two events responding to wmi
> InstanceOperationEvent.
> namely creation and deletion
>
> nevertheless I see there are a modified also
>
> What am I missing?
>
> I tried this...
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & _
> strComputer & "\root\cimv2")
> Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> ("SELECT * FROM __InstanceOperationEvent WITHIN 0.1 WHERE " _
> & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
> & "TargetInstance.GroupComponent= " _
> & "'Win32_Directory.Name=""C:\\\\temp\\\
> \myfolder""'")
> Do
> Set objLatestEvent = colMonitoredEvents.NextEvent
> msgbox "event is " & objLatestEvent.path_.class
> loop
>
> Cheers

Did you check this item from the Scripting Guy's column?

"How Can I Check Every 30 Minutes to See If a File Has Been Modified?"
http://blogs.technet.com/b/heyscriptingguy/archive/2007/07/23/how-can-i-check-every-30-minutes-to-see-if-a-file-has-been-modified.aspx

From: Leon on
Yes I did - I can not make it work

http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/04/how-can-i-monitor-for-different-types-of-events-with-just-one-script.aspx

Here is stated...

• __InstanceCreationEvent. This is used for monitoring creation
events; that is, you can be notified any time a new instance of
something gets created. In our case, notification will occur any time
a new file is created in the folder C:\Scripts.

• __InstanceDeletionEvent. You’re way ahead of us: this class is used
for monitoring deletion events; we’ll be notified any time a file is
deleted from C:\Scripts.

• __InstanceModificationEvent. Finally, we can be notified any time a
file in C:\Scripts is modified in some way (you change the file name,
you add or delete something from the file, etc.).


>>>>
But guess what: there’s a better way. Turns out there’s actually a
fourth WMI event class: __InstanceOperationEvent. Best of all, our
other three event classes are all subsumed under
__InstanceOperationEvent; you can use __InstanceOperationEvent to
monitor for event creations, event deletions, and event modifications.
We’ll use it today to monitor for both file creations and deletions.
>>>>

"and event modifications"

I can't make the "__InstanceModificationEvent" work.




On 4 Aug., 17:21, "Pegasus [MVP]" <n...(a)microsoft.com> wrote:
> "Leon" <kim.zeth...(a)gmail.com> wrote in message
>
> news:100c670e-7695-4fce-8711-01daeace4d69(a)m1g2000yqo.googlegroups.com...
>
>
>
>
>
> > Hi
>
> > it seem there are only two events responding to wmi
> > InstanceOperationEvent.
> > namely creation and deletion
>
> > nevertheless I see there are a modified also
>
> > What am I missing?
>
> > I tried this...
>
> > strComputer = "."
> > Set objWMIService = GetObject("winmgmts:" _
> >    & "{impersonationLevel=impersonate}!\\" & _
> >        strComputer & "\root\cimv2")
> >    Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> >    ("SELECT * FROM __InstanceOperationEvent WITHIN 0.1 WHERE " _
> >        & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
> >            & "TargetInstance.GroupComponent= " _
> >                & "'Win32_Directory.Name=""C:\\\\temp\\\
> > \myfolder""'")
> > Do
> >    Set objLatestEvent = colMonitoredEvents.NextEvent
> >    msgbox "event is " & objLatestEvent.path_.class
> > loop
>
> > Cheers
>
> Did you check this item from the Scripting Guy's column?
>
> "How Can I Check Every 30 Minutes to See If a File Has Been Modified?"http://blogs.technet.com/b/heyscriptingguy/archive/2007/07/23/how-can...- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

From: Kenneth A. Larsen on

"Leon" <kim.zethsen(a)gmail.com> wrote in message
news:573ad260-1953-468d-b52e-5934af8588fe(a)c10g2000yqi.googlegroups.com...
I see I'm a little unclear
What I mean is i have read ther are a event to be captured when files
are modified.
That should be included in InstanceOperationEvent - but it does not
work.
Only 2 events are comming up - creation and deletion

On 4 Aug., 16:00, Leon <kim.zeth...(a)gmail.com> wrote:
> Hi
>
> it seem there are only two events responding to wmi
> InstanceOperationEvent.
> namely creation and deletion
>
> nevertheless I see there are a modified also
>
> What am I missing?
>
> I tried this...
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & _
> strComputer & "\root\cimv2")
> Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> ("SELECT * FROM __InstanceOperationEvent WITHIN 0.1 WHERE " _
> & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
> & "TargetInstance.GroupComponent= " _
> & "'Win32_Directory.Name=""C:\\\\temp\\\
> \myfolder""'")
> Do
> Set objLatestEvent = colMonitoredEvents.NextEvent
> msgbox "event is " & objLatto estEvent.path_.class
> loop
>
> Cheers

Dear Leon,
You forgot to check you're spelling and grammar. And I think what you're
missing is you should do 2 things with those files you typed on this E-Mail
is you could type them in MS-Dos Prompt if you have that on you're computer.
Or if you have those files, you can see if you have them in Windows
Explorer. If you have any problems, please let me know by emailing me at 2
addresses. LarsenK(a)verizon.net or kuhlpc#2(a)optimum.net.

From,
Kenny


 |  Next  |  Last
Pages: 1 2 3
Prev: Desktop Labeling....
Next: Hinding hta source