|
Hi
I'm using following FUNCTION to determine if "notepad.exe" is running and if its not, start "notepad.exe". Problem then running this on terminal server, if another user (in another session) is running notepad.exe it will not start notepad.exe. How can I change so it checks if it is @USERID (current user) that has started notepad.exe?
IF NOT FindPROC("notepad.exe") RUN "notepad.exe" ENDIF
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.Name Next ENDFUNCTION
/Stefan Duvander
|