Assuming that the OP is trying to get the list of running processes running
under the currently logged on user account, the following WMI script should
help:
Lists all the processes running in the currently logged on user account.
- - -
strComputer = "."
Dim strUserName
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")
For Each objItem in colItems
strUserName = objItem.UserName
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If strUserDomain & "\" & strNameOfUser = strUserName Then
WScript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strNameOfUser & "."
End If
Next
- - -
--
Regards,
Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting
http://www.winhelponline.com
Making Good Newsgroup Posts
http://www.dts-l.org/goodpost.htm
MAKE A GOOD NEWSGROUP POST
http://home.satx.rr.com/badour/html/post.html
Newsgroups - Unanswered Questions
http://www.michna.com/kb/Newsgroups.htm
How to ask a question
http://support.microsoft.com/?id=555375
Note: KB555375 is for Microsoft Windows XP Professional not Microsoft
Windows XP Home. ;-)
--
Hope this helps. Let us know.
Wes
MS-MVP Windows Shell/User
In