title: How to get the count from WMI class listed values...
body: <p>I have below vbscript.... when executed it will give all the applications that are in this class "SELECT * FROM Application".. What I wanted is a count of these application... I am looking for this script to have in vbscript or powrershell...</p>
  
  <p>Count of Package Name in totall.. say if the app-v client has 10 diffrent apllications it should show as 10 apps are there...</p>
  
  <pre><code>On Error Resume Next
  
  Const wbemFlagReturnImmediately = &amp;h10
  Const wbemFlagForwardOnly = &amp;h20
  
  arrComputers = Array(".")
  For Each strComputer In arrComputers
  WScript.Echo
  WScript.Echo "=========================================="
  WScript.Echo "Computer: " &amp; strComputer
  WScript.Echo "=========================================="
  
  Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\microsoft\appvirt\client")
  Set colItems = objWMIService.ExecQuery("SELECT * FROM Application", "WQL", _
  wbemFlagReturnImmediately + wbemFlagForwardOnly)
  
  For Each objItem In colItems
  WScript.Echo "CachedOsdPath: " &amp; objItem.CachedOsdPath
  WScript.Echo "GlobalRunningCount: " &amp; objItem.GlobalRunningCount
  WScript.Echo "LastLaunchOnSystem: " &amp; WMIDateStringToDate(objItem.LastLaunchOnSystem)
  WScript.Echo "Loading: " &amp; objItem.Loading
  WScript.Echo "Name: " &amp; objItem.Name
  WScript.Echo "OriginalOsdPath: " &amp; objItem.OriginalOsdPath
  WScript.Echo "PackageGUID: " &amp; objItem.PackageGUID
  WScript.Echo "Version: " &amp; objItem.Version
  WScript.Echo
  Next
  Next
  
  
  Function WMIDateStringToDate(dtmDate)
  WScript.Echo dtm: 
  WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) &amp; "/" &amp; _
  Mid(dtmDate, 7, 2) &amp; "/" &amp; Left(dtmDate, 4) _
  &amp; " " &amp; Mid (dtmDate, 9, 2) &amp; ":" &amp; Mid(dtmDate, 11, 2) &amp; ":" &amp; Mid(dtmDate,13, 2))
  End Function
  </code></pre>