Page 1 of 1 1
Topic Options
#121177 - 2004-06-12 02:26 PM View owner of process
Nickless Offline
Lurker

Registered: 2004-06-12
Posts: 1
hi all,

is there is someone who knows how to retrieve the owner of a process using wmi ?
I've done the following but it doesn't work....
------------------------------------------------------------
FUNCTION ViewProcess($Host)

$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $Host + "\root\cimv2")
$WSql = "SELECT * FROM Win32_Process"

$colProcess = $objWMIService.ExecQuery($WSql)

FOR EACH $process IN $colProcess
? $Process.Name
$ReturnVal = $process.GetOwner($strUser, $strDomain)
IF ReturnVal = 0
? $strUser
? $strDomain
ENDIF
NEXT

ENDFUNCTION
------------------------------------------------------------
$strUser and $strDomain stays empty...:(

someone an idea ?

thanks for help...

Top
#121178 - 2004-06-12 04:58 PM Re: View owner of process
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Have some bad news for you. This line here:

$ReturnVal = $process.GetOwner($strUser, $strDomain)

is not supported in Kixtart. It takes two parameters that are defined as OUT and Kixtart wont dynamically create them for you. You would need to find another way to get this information (say, as properties) but a quick scan of MSDN yields nothing for this (did only a quick search).

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.091 seconds in which 0.066 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org