List XenApp Editions in CSV format
Description
This sample code uses MFCOM to list the product editions of all servers in the farm. It is based on the servers.wsf example in the XenApp Management Software Development Kit (MPSSDK/MFCOM).
Instructions
- Paste the code into a text file
- Save the text file as ListServerEditions.wsf
- Open a command prompt, navigate to the directory containing the ListServerEditions.wsf script and execute the below command to save the results to a .csv file that an be opened in Excel:
cscript //nologo ListServerEditions.wsf > serverEditions.csv
Download
<Upload the script or the tool and have the URL of the download here>
Code Snippet
<package>
<job id="ListServerEditions">
<comment>
File: ListServerEditions.wsf
Description: List the product editions of all servers in the farm and output in a .csv format for easy opening and sorting in a spreadsheet application.
Requirements: WSH 5.5 or higher.
</comment>
<runtime>
<description>
List the product editions of all servers in the farm and output in a .csv format for easy opening and sorting in a spreadsheet application.
</description>
<example>
CScript //nologo ListServerEditions.wsf > serveEditions.csv
</example>
</runtime>
<reference object="MetaFrameCOM.MetaFrameFarm"/>
<script language="VBScript">
Dim theFarm, aServer, aWinServer
'
' Create MetaFrameFarm object
'
Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
if Err.Number <> 0 Then
WScript.Echo "Can't create MetaFrameFarm object"
WScript.Echo "(" & Err.Number & ") " & Err.Description
WScript.Echo ""
WScript.Quit Err.Number
End if
'
' Initialize the farm object.
'
theFarm.Initialize(MetaFrameWinFarmObject)
if Err.Number <> 0 Then
WScript.Echo "Can't Initialize MetaFrameFarm object"
WScript.Echo "(" & Err.Number & ") " & Err.Description
WScript.Echo ""
WScript.Quit Err.Number
End if
'
' Are you Citrix Administrator?
'
if theFarm.WinFarmObject.IsCitrixAdministrator = 0 then
WScript.Echo "You must be a Citrix admin to run this script"
WScript.Echo ""
WScript.Quit 0
End If
'
' Display all servers in the farm.
'
WScript.Echo "Server,Edition"
For Each aServer In theFarm.Servers
if Err.Number <> 0 Then
WScript.Echo "Can't enumerate servers"
WScript.Echo "(" & Err.Number & ") " & Err.Description
WScript.Echo ""
WScript.Quit Err.Number
End if
'
' MetaFrameWinServer object.
'
Set aWinServer = aServer.WinServerObject
' Print server name and edition - seperated by a ,s
wscript.echo aServer.ServerName & "," & aWinServer.MFWinName
Next
</script>
</job>
</package>
Disclaimer
These software applications are provided to you as is with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.
Add Comment