1

I am trying to write vbs to find owner of process. Can you please help me?

Nil B
  • 195
  • 2
  • 9
  • http://technet.microsoft.com/en-us/library/ee176712.aspx this describes it and is directly from Microsoft's text about Scripting. You should ideally use PowerShell! – apollosoftware.org Nov 02 '12 at 21:32

1 Answers1

7

My google-fu is strong

Microsoft Windows 2000 Scripting Guide - Determining Process Owners

strComputer = "."
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)
 Wscript.Echo "Process " & objProcess.Name & " is owned by " _
 & strUserDomain & "\" & strNameOfUser & "."
Next
billinkc
  • 59,250
  • 9
  • 102
  • 159