Contact Info

Crumbtrail » Administration » Scripts » WMI Performance Counters » VBScript

TerminalService - WMI sample in VBScript

The foundations for Manageability in Windows 2019/2012/2008/ and Windows 10/8/7/Vista/XP are 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.

On this site, you can find many WMI samples.

The TerminalService WMI class can be used in ActiveXperts Network Monitor to monitor your servers.



Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_TerminalService")

For Each objItem in colItems
	WScript.Echo "AcceptPause:" & objItem.AcceptPause
	WScript.Echo "AcceptStop:" & objItem.AcceptStop
	WScript.Echo "Caption:" & objItem.Caption
	WScript.Echo "CheckPoint:" & objItem.CheckPoint
	WScript.Echo "CreationClassName:" & objItem.CreationClassName
	WScript.Echo "Description:" & objItem.Description
	WScript.Echo "DesktopInteract:" & objItem.DesktopInteract
	WScript.Echo "DisconnectedSessions:" & objItem.DisconnectedSessions
	WScript.Echo "DisplayName:" & objItem.DisplayName
	WScript.Echo "ErrorControl:" & objItem.ErrorControl
	WScript.Echo "ExitCode:" & objItem.ExitCode
	WScript.Echo "InstallDate:" & objItem.InstallDate
	WScript.Echo "Name:" & objItem.Name
	WScript.Echo "PathName:" & objItem.PathName
	WScript.Echo "ProcessId:" & objItem.ProcessId
	WScript.Echo "ServiceSpecificExitCode:" & objItem.ServiceSpecificExitCode
	WScript.Echo "ServiceType:" & objItem.ServiceType
	WScript.Echo "Started:" & objItem.Started
	WScript.Echo "StartMode:" & objItem.StartMode
	WScript.Echo "StartName:" & objItem.StartName
	WScript.Echo "State:" & objItem.State
	WScript.Echo "Status:" & objItem.Status
	WScript.Echo "SystemCreationClassName:" & objItem.SystemCreationClassName
	WScript.Echo "SystemName:" & objItem.SystemName
	WScript.Echo "TagId:" & objItem.TagId
	WScript.Echo "TotalSessions:" & objItem.TotalSessions
	WScript.Echo "WaitHint:" & objItem.WaitHint
	WScript.Echo ""
	WScript.Echo "########"
	WScript.Echo ""