Script to list all Citrix servers in a farm


=============================================================

On Error Resume Next

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

ctxServer = “.”

Set objWMIService = GetObject(“winmgmts:\\” & ctxServer & “\root\Citrix”)

Set colItems = objWMIService.ExecQuery(“SELECT * FROM Citrix_Server”, “WQL”, _

wbemFlagReturnImmediately + wbemFlagForwardOnly)

Set objFSO = CreateObject(“Scripting.FileSystemObject”)

If objFSO.FileExists(“FarmServers.txt”) Then

objFSO.DeleteFile “FarmServers.txt”

End If

Set objOutput = objFSO.CreateTextFile(“FarmServers.txt”)

For Each objItem In colItems

objOutput.WriteBlankLines

objOutput.WriteLine “==========================================”

objOutput.WriteLine “Server Name: ” & objItem.ServerName

objOutput.WriteLine “==========================================”

objOutput.WriteLine “Domain: ” & objItem.Domain

objOutput.WriteLine “Farm Name: ” & objItem.FarmName

objOutput.WriteLine “IP Address: ” & objItem.IPAddress

objOutput.WriteLine “Logins Enabled: ” & objItem.LoginsEnabled

objOutput.WriteLine “Zone Name: ” & objItem.ZoneName

objOutput.WriteLine “Zone Ranking: ” & objItem.ZoneRanking

objOutput.WriteBlankLines(2)

Next

objOutput.Save

objOutput.Close

Set objShell = CreateObject(“WScript.Shell”)

objShell.Run “notepad.exe FarmServers.txt”

=============================================================

Advertisements
Script to list all Citrix servers in a farm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s