Returns a list of threads and thread states for each process running on a computer
Set objDictionary = CreateObject("Scripting.Dictionary")strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colProcesses = objWMIService.ExecQuery _("Select * from Win32_Process")For each objProcess in colProcessesobjDictionary.Add objProcess.ProcessID, objProcess.NameNextSet colThreads = objWMIService.ExecQuery _("Select * from Win32_Thread")For each objThread in colThreadsintProcessID = CInt(objThread.ProcessHandle)strProcessName = objDictionary.Item(intProcessID)Wscript.Echo strProcessName & VbTab & objThread.ProcessHandle & _VbTab & objThread.Handle & VbTab & objThread.ThreadStateNext
This is a VB Script, this can be used by saving the file in .vbs file