scripting@wanadoo.nl




FindPROC()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
18 June 2002 FindPROC()
AuthorRadimus
Action Returns the PID of the requested process.
SyntaxFindPROC ($proc, optional $computer, optional $terminate) 
Parameters
  • $proc (Required / String) name of the process / exe
  • $computer (Optional / String) name of the target computer.. if blank it assumes local pc
  • $terminate (Optional / String) whether or not to kill the process. any non-zero/null is accepted 
  • RemarksUsefull to kill local proceses, or in an admin script against remote PCs. 
    Returnspid of the requested process 
    DependenciesWMI 
    Examples
    FindPROC("aim.exe",,1)
    
     
    Source
    FUNCTION FindPROC ($proc, OPTIONAL $computer, OPTIONAL $terminate)
      DIM $getobject, $select
      IF NOT $computer
        $computer=@wksta
      ENDIF
    
      $getobject="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
      $select="select * from Win32_Process where Name='$PROC'"
      FOR EACH $process IN GetObject("$GetObject").execquery("$select")
        IF $terminate
          $process.terminate
        ENDIF
        $findproc=$process.processid
      NEXT
    ENDFUNCTION ; - FindPROC -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter