Remotely installing Filters and consumers

D

Dave

I'm trying to create a filter/consumer pairing to monitor any reduction
in the number of pointing objects (ie. mice) attached to my lab machines
(I'm in a teaching enviroment).

I can do this on a local machine with a vbscript run as administrator,
but I'm having great trouble doing it to remote machines - of course, I
don't _need_ to be able to do it remotely, but I feel I really should
know why I can't.

The essential bits of my script goes as per below.

Using wbemtest, they all appear to have gone into my target machine - but
I either get an error 0x80041002 in the event log of the remote machine
(probably me not clearing out non-working eventfilters before I re-run
the script), and a line:

(Thu May 19 16:43:20 2005.201428015) : Repository called with a thread
token! It shall be removed

In Wbemcore.log. I can find little about doing this sort of thing
remotely (as I said, it all seems to work fine locally). I don't think
permissions are (at least not directly) the problem, as this script is
running within the context of a administrator on both my machine and the
target.

Can anyone offer me advice as to anything I've done obviously wrong, or
resources on the net that may be of use?

Many thanks
Dave,
Bath.



Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objEventFilterClass = objSWbemServices.Get("__EventFilter")
Set objEventFilter = objEventFilterClass.SpawnInstance_
Set objSMTPConsumerClass = objSWbemServices.Get("SMTPEventConsumer")
Set objSMTPConsumer = objSMTPConsumerClass.SpawnInstance_()
Set objSMTPBindingInstance = objBindingClass.SpawnInstance_()

objEventFilter.Name = "MouseDeleteEventFilter"
'objEventFilter.EventNamespace = ""
objEventFilter.QueryLanguage = "WQL"
objEventFilter.Query = "SELECT * FROM __InstanceDeletionEvent " &_
"WITHIN 5 WHERE TargetInstance ISA " &_
"""Win32_PointingDevice"""
objEventFilter.Put_

objSMTPConsumer.Name = "MouseRemovedEMAIL"
objSMTPConsumer.ToLine = "xxxx@xxx"
objSMTPConsumer.FromLine = "xxx@xxx"
objSMTPConsumer.ReplyToLine = "xxx@xxxx"
objSMTPConsumer.SMTPServer = "mailhost"
objSMTPConsumer.Subject = "Mouse Theft alert!"
objSMTPConsumer.Message = "Someone has has just unplugged a mouse from "
& strComputer &"."
objSMTPConsumer.Put_()


objSMTPBindingInstance.Filter = "\\" & strComputer & "\root\cimv2:
__EventFilter.Name=""MouseDeleteEventFilter"""
objSMTPBindingInstance.Consumer="\\" & strComputer & "\root
\cimv2:SMTPEventConsumer.Name=""MouseRemovedEMAIL"""
objSMTPBindingInstance.Put_()
 
Top