Re: ScriptText - ActiveScriptEventConsumer - Create

From: Sarika Sharma[MSFT] (sarikas_at_online.microsoft.com)
Date: 04/22/04


Date: Thu, 22 Apr 2004 09:04:24 -0700

So let me understand

You are running w2k sp4 on the machine you are trying to create the process
(notepad interactively)
And this machine is local machine that is where you launch the script also.
The process gets created but is not interactive, can you check under what
useraccount is notepad running when launched by consumer using task manager

-- 
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
"Déborah" <anonymous@discussions.microsoft.com> wrote in message
news:51D91491-A806-4965-A8B9-298CFE9D9EFC@microsoft.com...
>
> Hi Sarika. Thanks for your comments.
>
> The script seems not to be interactive locally.
>
> When I execute this simple script under local machine,
>
>                    Dim objLocator_2, objReini, strComputer
>                    strComputer = "."
>                    Set objLocator_2 =
CreateObject("WbemScripting.SwbemLocator")
>                    Set objReini =
objLocator_2.Connectserver(strComputer).Get("Win32_Process")
>                    objReini.Create("Notepad.exe")
>
> it works fine. It creates an interactive process of notepad.
>
> But when I include it as the ScriptText of the consumer of a permanent
event script, the process is created but it isn't interactive, although I
run it under local machine
>
> I've read in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/creating_processes_remotely.asp,
that in Windows 2000 SP 2 and earlier:  Win32_Process.Create can create an
interactive process remotely.
>
> I have Windows 2000 SP4 and Execute Method and Remote Enable permissions,
but the process created is not interactive.
>
> Do you know where can be the problem?
>
> Thank you very much.
>
> Greetings.  Déborah
>
> Here's the text  of the permanent event script:
>
> 'FILTER
>
> Dim objClsEventFilter
> Dim objInstOfEventFilter
>
> Dim objLocator_1
> Set objLocator_1 = CreateObject ("WbemScripting.SwbemLocator")
> Set objClsEventFilter =
objLocator_1.ConnectServer(strComputer).Get("__EventFilter")
>
> Set objInstOfEventFilter = objClsEventFilter.SpawnInstance_()
>
> strWQL = "SELECT * FROM __InstanceDeletionEvent WITHIN 5 WHERE
TargetInstance ISA 'Win32_Process' and TargetInstance.Name='Notepad.exe' "
> objInstOfEventFilter.Properties_.Item("Name") = "Hola"
> objInstOfEventFilter.Properties_.Item("Query") = strWQL
> objInstOfEventFilter.Properties_.Item("QueryLanguage") = "WQL"
> objInstOfEventFilter.Put_()
>
> 'CONSUMER
>
> Dim objClsActiveScriptEventConsumer
> Dim objInstOfActiveScriptEventConsumer
>
> TextoScript = "Dim objLocator_2, objReini" & vbCrLf &_
>                 "Set objLocator_2 =
CreateObject(""WbemScripting.SwbemLocator"")" & vbCrLf &_
> "Set objReini =
objLocator_2.Connectserver(strComputer).Get(""Win32_Process"")" & vbCrLf &_
> "objReini.Create(""Notepad.exe"")"
>
> Dim objLocator_6
> Set objLocator_6 = CreateObject ("WbemScripting.SwbemLocator")
> Set objClsActiveScriptEventConsumer =
objLocator_6.ConnectServer(strComputer).Get("ActiveScriptEventConsumer")
>
> Set objInstOfActiveScriptEventConsumer =
objClsActiveScriptEventConsumer.SpawnInstance_()
>
> objInstOfActiveScriptEventConsumer.Properties_.Item("Name")= "Adios"
> objInstOfActiveScriptEventConsumer.Properties_.Item("ScriptText")=
TextoScript
> objInstOfActiveScriptEventConsumer.Properties_.Item("ScriptingEngine")=
"VBScript"
>
> objInstOfActiveScriptEventConsumer.Put_()
>
> 'BINDING
>
> Dim objClsFilterToConsBinding
> Dim objInstOfFilterToConsBinding
>
> Dim objLocator_3
> Set objLocator_3 = CreateObject ("WbemScripting.SwbemLocator")
> Set objClsFilterToConsBinding =
objLocator_3.ConnectServer(strComputer).Get("__FilterToConsumerBinding")
>
> Set objInstOfFilterToConsBinding =
objClsFilterToConsBinding.SpawnInstance_()
>
> ruta="\root\cimv2:ActiveScriptEventConsumer.Name"
>
> objInstOfFilterToConsBinding.Properties_.Item("Consumer") = "\\" &
strComputer & ruta & "=""Adios"""
> objInstOfFilterToConsBinding.Properties_.Item("Filter") = "\\" &
strComputer & "\root\cimv2:__EventFilter.Name=""Hola"""
> objInstOfFilterToConsBinding.Properties_.Item("DeliverSynchronously") =
FALSE
>
> objInstOfFilterToConsBinding.Put_()
>


Relevant Pages

  • Re: ScriptText - ActiveScriptEventConsumer - Create
    ... The script seems not to be interactive locally. ... But when I include it as the ScriptText of the consumer of a permanent event script, the process is created but it isn't interactive, although I run it under local machine ... Dim objClsEventFilter ... Dim objInstOfEventFilter ...
    (microsoft.public.win32.programmer.wmi)
  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: Password Expire
    ... We have one fron end Edge server in our DMZ which passes email onto two ... I used to schedule a script to run every 24 hours on my Exchange 2003 ... Dim fso, txtarray, BodyText ... Call ProcessFolder (objContainer, numDays) ...
    (microsoft.public.exchange.admin)
  • Re: LDAP query information
    ... a "Dim" statement. ... execution of the script. ... ' Filter on computer object. ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)
  • Re: Script: Remote shutdown of all domain computers
    ... When trying to run the script from a XP workstation, where i am logged in as ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... 2000 or above and allow shutdown, ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)