WEBfactory 2010

Windows WMI functionality inside WEBfactory VChannels

Abstract

Chec out this article and learn how the Windows WMI functionality works in context of WEBfactory 2010 VChannels.

Using the Windows WMI functionality, the user can retrieve hardware information like HDD capacity, memory consumption, etc. The Windows WMI functionality can be easily used inside a WEBfactory VChannel in order to retrieve system information.

Important

When used inside a VCahannel, the trigger interval must not be too short, in order to avoid high CPU load (for example, trigger period of 15 seconds or longer).

Retrieving system information using WMI in WEBfactory VChannels

To retrieve system information using the WMI functionality inside a VChannel, the user must place the appropriate script in the VChannel script textbox, under the Signal Details panel.

Using the WMI to retrieve the WEBfactory Service state in VChannel

In the above example, the VChannel will retrieve the WEBfactory Service State. The required script for this action is:

Sub GetResult() 
  Result = "unknown" 
strComputer = "."
Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name ='WTS'")
For Each objService in colListOfServices
Result = objService.Name  & " Running State:" & objService.State

Next
End Sub

Click on the next examples to see how to get the HDD capacity, HDD free space and memory usage.

Depending on the Result type (string, int), the value might not be visible in WEBfactory 2010Test Center. If the Result is of type string, it can be viewed using the appropriate control (WFTextDisplay1) in WEBfactorySmartEditor or Expression Blend.

Click here for more information on WMI System Classes or paste the following link in the browser's navigation bar: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394583(v=vs.85).aspx