Created
August 28, 2018 17:57
-
-
Save joenorton8014/dbf6d12a12e5ef637b9be666448a8497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim list | |
Set list = CreateObject("System.Collections.ArrayList") | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | |
Set colItems = objWMIService.ExecQuery( _ | |
"SELECT * FROM Win32_Process",,48) | |
For Each objItem in colItems | |
list.Add objItem.ProcessId | |
Next | |
list.Sort | |
For Each objitem in list | |
Set objShare = objWMIService.Get("Win32_Process.Handle=" & objitem) | |
Set objOutParams = objWMIService.ExecMethod("Win32_Process.Handle=" & objitem , "GetOwner") | |
if objOutParams.User = "SYSTEM" Then | |
Wscript.echo "==========================" | |
Wscript.echo "PID Numnber: " & objitem | |
Wscript.echo "==========================" | |
Wscript.Echo "Out Parameters: " | |
Wscript.echo "Domain: " & objOutParams.Domain | |
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue | |
Wscript.echo "User: " & objOutParams.User | |
Wscript.echo "" | |
End If | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment