Remotely installing Filters and consumers



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_()
.



Relevant Pages

  • Re: Remotely installing Filters and consumers
    ... This unfortunately leads to other errors in the script but this hopefully ... > but I'm having great trouble doing it to remote machines - of course, ... they all appear to have gone into my target machine - but ... > Set objSMTPConsumer = objSMTPConsumerClass.SpawnInstance_ ...
    (microsoft.public.windowsxp.wmi)
  • Re: Remotely installing filters and consumers
    ... Now I know who to go to for my event problems. ... >> but I'm having great trouble doing it to remote machines - of course, ... >> The essential bits of my script goes as per below. ... they all appear to have gone into my target machine - but ...
    (microsoft.public.win32.programmer.wmi)
  • Re: remotely query group membership of machine via script/wmi
    ... so excuse me in advance if this is a dumb question. ... > administrators group on certain remote machines and I am hoping I can ... > use a script to do that. ...
    (microsoft.public.windowsxp.wmi)
  • remotely query group membership of machine via script/wmi
    ... so excuse me in advance if this is a dumb question. ... administrators group on certain remote machines and I am hoping I can ... Can someone help me with an example script of how to do this? ...
    (microsoft.public.windowsxp.wmi)

Loading