Richard Parmiter

Virtualisation blog and Knowledge Base

  • You are here: 
  • Home
  • serverlist

Script to export all the servers in a Citrix Farm

Posted on April 27th, 2009

Sometimes it is useful to have a list of servers in a text file in order to perform some other task. The following script will export all servers from a Citrix Farm and add them to a text file.

This script uses the built in Citrix tool, qfarm, and cleans up the output to provide the required list. It uses a temporary file (qfarmservers.txt) during the process and deletes it at the end.

REM ***************************************************
REM qfarmservers  = output from a qfarm /servers
REM serverlist    = cleaned up list of all servers in farm
REM ***************************************************

SET qfarmservers=c:\windows\temp\qfarmservers.txt
SET serverlist=c:\windows\temp\serverlist.txt

qfarm /servers >>%qfarmServers%
for /f “skip=3 tokens=1″ %%1 in (%qfarmservers%) do (
echo %%1 >> %serverlist%
)
Del %qfarmservers% /q

Just change the log file location(s) as required.

Tags: , , , , , , , , ,
Filed under Scripts/Reg | 1 Comment »