本文介绍了VBScript,如何找到给定进程的所有者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写 vbs 来查找进程的所有者.你能帮我吗?
I am trying to write vbs to find owner of process. Can you please help me?
推荐答案
My google-fu 很强大
Microsoft Windows 2000 脚本指南 - 确定流程所有者
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
这篇关于VBScript,如何找到给定进程的所有者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!