Monday, September 20, 2010

SCRIPT: How to enumerate citrix applications in a remote citrix server using WMI and VB.NT

How to enumerate citrix applications in a remote citrix server using WMI and VB.NET (no MFCOM required)

Imports System
Imports System.Management


Dim strComputer As String = "ctxserver01"

Dim oConn As ConnectionOptions = New ConnectionOptions
oConn.Username = "domain\username"
oConn.Password = "password"

Dim scope As New ManagementScope("\\" & strComputer & "\root\Citrix", oConn)
scope.Connect()

Dim objectQuery As New ObjectQuery("SELECT * FROM MetaFrame_ApplicationsPublishedOnServer")
Dim searcher As New ManagementObjectSearcher(scope, objectQuery)
For Each ctxApp In searcher.Get()
lstAppList.Items.Add(ctxApp("WinApp"))
Next ctxApp

No comments: