Win32_Thread vbscript sample code | ActiveXperts Network Monitor
The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_Thread WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Description
The Win32_Thread WMI class represents a thread of execution. While a process must have one thread of execution, the process can create other threads to execute tasks in parallel. Threads share the process environment, thus multiple threads under the same process use less memory than the same number of processes.
Sample Code
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Thread",,48)
For Each objItem in colItems
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "CreationClassName: " & objItem.CreationClassName
Wscript.Echo "CSCreationClassName: " & objItem.CSCreationClassName
Wscript.Echo "CSName: " & objItem.CSName
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "ElapsedTime: " & objItem.ElapsedTime
Wscript.Echo "ExecutionState: " & objItem.ExecutionState
Wscript.Echo "Handle: " & objItem.Handle
Wscript.Echo "InstallDate: " & objItem.InstallDate
Wscript.Echo "KernelModeTime: " & objItem.KernelModeTime
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "OSCreationClassName: " & objItem.OSCreationClassName
Wscript.Echo "OSName: " & objItem.OSName
Wscript.Echo "Priority: " & objItem.Priority
Wscript.Echo "PriorityBase: " & objItem.PriorityBase
Wscript.Echo "ProcessCreationClassName: " & objItem.ProcessCreationClassName
Wscript.Echo "ProcessHandle: " & objItem.ProcessHandle
Wscript.Echo "StartAddress: " & objItem.StartAddress
Wscript.Echo "Status: " & objItem.Status
Wscript.Echo "ThreadState: " & objItem.ThreadState
Wscript.Echo "ThreadWaitReason: " & objItem.ThreadWaitReason
Wscript.Echo "UserModeTime: " & objItem.UserModeTime
Next
