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.txtqfarm /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: Citrix, export, Presentation Server, qfarm, script, server, serverlist, servers, text, XenApp
Filed under Scripts/Reg | 1 Comment »
MFCOM script to export the current users of an application
Posted on April 27th, 2009
Sometimes is is necessary to have a list of users in a text file of which other scripts can be run. In this case I wanted a list of all users currently logged into a specific Citrix application in order to perform some other task.
The following MFCOM script will export all the users currently logged into a specified application and export them to a text file.
Set objFarm = CreateObject(“MetaFrameCOM.MetaFrameFarm”)
Dim ObjFSO, Objuserlist
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set Objuserlist = objFSO.OpenTextFile(“c:\windows\temp\userlist.log”, 8, True)objFarm.Initialize(1)
For Each objSession In objfarm.Sessions
if objsession.appname = (“My Application Name”) then
objuserlist.WriteLine(objSession.UserName)
End IF
NextWScript.Echo “userlist created here – c:\windows\temp\userlist.log”
Substitute “My Application name” and the log file location as appropriate.
Save this as a .vbs file and run.
Tags: Citrix, export, list, mfcom, Presentation Server, scipt, user, vb
Filed under Scripts/Reg | 1 Comment »
How to export the users of an AD Group.
Posted on January 23rd, 2009
This is the best and fastest way to export all users who are members of a group
dsquery group “CN=Group Name,OU=OU Location,DC=Domain Name,DC=local” | dsget group -members | dsget user -samid -c >>c:\windows\temp\groupmembers.txt
If there are nested groups it might fail with the following error message:
The object class of the target does not match the one specified on the command line.
This error is removed by adding the -c variable as this continues despite the error.
Tags: AD, dsget, dsquery, export, group extraction, script, users
Filed under Scripts/Reg | No Comments »
