Hello Sirs,

I have a problem using a variable with the following line of code:


Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceModificationEvent WITHIN 2 WHERE " _
& "TargetInstance ISA 'CIM_DataFile' and " &
"TargetInstance.Name=" & "'objFile'")


The objfile variable points to a file in the format c:\\scripts\
\test.txt.
If I replace the variable with the file name the script works
correctly.
Any ideas are very, very welcome.


Thanks!
zz

Re: problem using variable with wmi query... by zerbie45

zerbie45
Thu Mar 29 02:21:43 CDT 2007

Hello Alex,

thank you very much, it works now !!!!

Regards,
zz

On Mar 28, 10:25 pm, Alexander Mueller <mille...@hotmail.com> wrote:
> 28.03.2007 21:20, zerbi...@gmail.com schrieb:
>
>
>
>
>
> > Hello Sirs,
>
> > I have a problem using a variable with the following line of code:
>
> > Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> > ("SELECT * FROM __InstanceModificationEvent WITHIN 2 WHERE " _
> > & "TargetInstance ISA 'CIM_DataFile' and " &
> > "TargetInstance.Name=" & "'objFile'")
>
> > The objfile variable points to a file in the format c:\\scripts\
> > \test.txt.
> > If I replace the variable with the file name the script works
> > correctly.
> > Any ideas are very, very welcome.
>
> Try
>
> Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> ("SELECT * FROM __InstanceModificationEvent WITHIN 2 WHERE " _
> & "TargetInstance ISA 'CIM_DataFile' and " _
> & "TargetInstance.Name='" & objFile & "'")
>
> MfG,
> Alex- Hide quoted text -
>
> - Show quoted text -