-
Documenting a Citrix XenApp 6.5 Farm with Microsoft PowerShell
October 7, 2011
A customer site I was at recently needed their new XenApp 6.0 farm documented. I remembered reading about Citrix having some PowerShell “stuff” for XenApp 6.0 so I started searching. I came across a short article by Michael Bogobowicz Getting a Farm Inventory With XenApp 6 PowerShell Scripting. That short article really piqued my interest. I took Michael’s little script as the starting point to learn Microsoft’s PowerShell. With some help from PowerShell MVP and fellow CTP Brandon Shell and a lot of help from Exchange MVP Michael B. Smith, I turned the original script into over 1800 lines of PowerShell to thoroughly document a XenApp 6 farm. For this article, I will update the original XenApp 6.0 documentation script for XenApp 6.5.
NOTE: This script is continually updated. You can always find the most current version by going to https://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/
This article will focus only on XenApp 6.5. There are already articles for XenApp 5 and XenApp 6.0 available on my web site.
The prerequisites to follow along with this article are:
- A server, physical or virtual, running Microsoft Windows Server 2008 R2 with or without SP1
- Citrix XenApp 6.5 installed
The nice thing about XenApp 6.5 compared to both XenApp 5 and XenApp 6 is that all the basic Citrix PowerShell stuff is installed when you install XenApp 6.5. But we still need the XenApp 6.5 PowerShell Help and the Citrix Group Policy PowerShell Commands.
My initial goal was to see if I could walk down the nodes in the AppCenter (Figure 1) and see if I could document every nook and cranny.
Figure 1 Before we can start using PowerShell to document anything in the XenApp 6.5 farm we first need to install the SDK (for the Help file) and Citrix Group Policy commands. From your XenApp 6.5 server, go to http://tinyurl.com/XenApp65PSSDK (Figure 2).
Figure 2 Scroll down and click on Download XenApp 6.5 Powershell SDK — Version 6.5 (Figure 3). Do not exit your Internet browser at this time.
Figure 3 Extract the file to C:\XA65SDK. Click Start, Run, type in C:\XA65SDK\XASDK6.5.exe and press Enter (Figure 4).
Figure 4 Click Run (Figure 5).
Figure 5 Select I accept the terms of this license agreement and click Next (Figure 6).
Figure 6 Select Update the execution policy (to AllSigned) and Click Next (Figure 7).
Note: If you do not update the execution policy to AllSigned, the Citrix supplied XenApp PowerShell scripts will not load.
Figure 7 Click Install (Figure 8).
Figure 8 After a few seconds, the installation completes. Click Finish (Figure 9).
Figure 9 Back in your Internet browser; go to http://tinyurl.com/XenApp6PSPolicies (Figure 10).
Figure 10 Scroll down and click on Citrix.GroupPolicy.Commands.psm1 (Figure 11).
Figure 11 Save the file in two different places:
C:\Windows\System32\WindowsPowerShell\v1.0\Modules, in a new folder named Citrix.GroupPolicy.Commands (Figure 12)
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules, in a new folder named Citrix.GroupPolicy.Commands (Figure 13)
Figure 12 Figure 13 You can now close your Internet browser.
Click Start, Administrative Tools, Windows PowerShell Modules.
To prepare for processing the Citrix farm policies, type in import-module Citrix.GroupPolicy.Commands and press Enter.
50 Responses to “Documenting a Citrix XenApp 6.5 Farm with Microsoft PowerShell”
Leave a Reply to Carl Webster
March 9, 2018 at 9:18 pm
Hi Everyone,
Please help me on make a documenting the “Loadevaluators” from XenApp6.5 used Application and Used by Server with script or whatever. It’s very urgent please help me on this..
Thanks in advance.
March 10, 2018 at 8:06 am
Um, run the script. All that is in the report created.
Webster
August 13, 2017 at 7:10 am
getting this error
PS C:\Users\TEMP> .\XA65_Inventory_V43.ps1
VERBOSE: 08/13/2017 13:09:44: Testing output parameters
VERBOSE: 08/13/2017 13:09:44: MSWord is set
VERBOSE: 08/13/2017 13:09:44: CoName is
Loading Windows PowerShell snap-in: Citrix.XenApp.Commands
VERBOSE: 08/13/2017 13:09:44: Remoting is not being used
VERBOSE: 08/13/2017 13:09:44: Getting initial Farm data
WARNING: Farm information could not be retrieved
C:\Users\TEMP\XA65_Inventory_V43.ps1 : Farm information could not be retrieved. Script cannot continue.
At line:1 char:1
+ .\XA65_Inventory_V43.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,XA65_Inventory_V43.ps1
August 13, 2017 at 7:18 am
Are you running the script on a Data Collector?
Webster
August 13, 2017 at 7:41 am
on a citrix test server
August 13, 2017 at 7:45 am
Did you follow the instructions in the ReadMe file?
Webster
August 13, 2017 at 7:46 am
Yes sir, I followed the same…help to run that script
August 13, 2017 at 7:48 am
On your test server, run a simple test. Start a PowerShell prompt and run the following commands:
add-pssnapin *citrix*
get-XAFarm
What happens?
Webster
August 13, 2017 at 7:56 am
FarmName : OUP
ServerVersion : 6.5.0
AdministratorType : Full
SessionCount : 6
MachineName : GBOXFCTX06
August 14, 2017 at 6:38 am
Apologies for the delayed response. It was Sunday and I actually took the day off the spend time with my wife and Simon and Sophie.
If you are running the script on the same computer you ran this quick test on, then it should just work. THe script has several warnings built in. It will error out if the server is not a Collector or if Word is not installed or the required PowerShell snap-in is not installed.
Webster
January 30, 2017 at 5:14 pm
Hi. I get a message saying. Max length of Server is 10.
January 31, 2017 at 7:54 pm
Not a problem. Just a message I put in there for when the output was not coming up right. I’ll remove it if I ever update the script again.
Webster
October 12, 2016 at 4:30 am
Dear Carl
I admire your jod and thank you.
Please at your first convenience help me on this.
I am running the 4.1 version of your script under 6.5 Farm, PoSH v2 and Office 2010. Script seems to be running at the moment smooth but I wonder why I cannot see the document file created in any folder.
October 14, 2016 at 8:30 am
Try running in 32-bit PowerShell. Several people have reported this issue on several scripts but I have never been able to reproduce it.
Webster
January 27, 2016 at 12:05 pm
Hey Carl, Victor again… I was able to run it for couple of 6.5 farms without any issue. But then I tried to run it for a XA 5 Windows 2008 farm and I am simply getting this.
I am Citrix administrator on that farm and I am able to run Discovery and all that stuff. Do you know more specifically what the issue might be with this? Ir there a workaround or this is just a no go for the XA 5.0?
I am using the XA52008 script version 4.2 from your downloads page.
C:\Victor Torres\Inventory\XenApp5_2008V4.2\XA52008_Inventory_V42.ps1 : Farm information could not be retrieved. Scrip
t cannot continue.
At line:1 char:28
+ .\XA52008_Inventory_V42.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,XA52008_Inventory_V42.ps1
January 27, 2016 at 12:09 pm
Did you read the ReadMe file for the 2008 script?
If you go to a PoSH session, load the snapins and run Get-XAFarm, does it work? If not, not an issue with the script.
Webster
January 27, 2016 at 1:17 pm
This is what I get when running Get-XAFarm
I am administrator (both Citrix and local) and IMA is started, I suppose I will have to look into enabling remoting.
Get-XAFarm Citrix commands must be executed at the Citrix server or using remoting. Make sure that your user account is a Citrix administrator and that the IMA service is started.
January 27, 2016 at 1:25 pm
Xenapp 5 cmdlets do not support remoting.
Webster
January 26, 2016 at 4:34 pm
Hello everyone… first of all thank you very much for such wonderful job.
Now I am not being able to run the script, I had to remove the first line which requires Powershell v3 because I cannot install v3 in the environment I am auditing. And I don’t know maybe I caused this issue but I am getting this… anyone else is having this issue?
Unexpected token ‘4’ in expression or statement.
At D:\Victor Torres\Inventory\XenApp65V4.25\XA65_Inventory_V42.ps1:5959 char:56
+ $ServerName = (Get-Childitem env:computername).value 4 <<<$Null
+ CategoryInfo : ParserError: (4:String) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
January 26, 2016 at 4:53 pm
How did you edit the file? If you used Notepad you broke the file. The file has lots of foreign characters in it which is why line 2 says to not edit the file in an ASCII editor.
The script can be run remotely. Can you not install PoSH V3 on a domain joined PC and run the script from there?
Webster
January 27, 2016 at 8:33 am
I edited with Notepad so I broke it… I read about PoSH V3 but I am auditing this environment which is pretty tight in resources and I am external consultant so not easy for me to get a test domain machine or server 🙁
Thanks for your quick response Carl… again awesome job!
January 27, 2016 at 8:36 am
Edit the original script with Wordpad and remove that line.
Webster
January 27, 2016 at 10:50 am
Thanks Carl!… as soon as I replied this morning I got with the IT guy and luckily they did have a test machine available.
I was able to run the script and it worked like a charm!!!
IT LOOKS AWESOME!!!
Thanks again!
May 22, 2015 at 5:09 am
Hello Carl,
Well Citrix did it again and I cant find this link anymore..
Before we can start using PowerShell to document anything in the XenApp 6.5 farm we first need to install the SDK (for the Help file) and Citrix Group Policy commands. From your XenApp 6.5 server, go to http://tinyurl.com/XenApp65PSSDK (Figure 2).
Any help that you can provide would be great.
May 23, 2015 at 10:57 am
The link works for me. It requires a MyCitrix login.
XenApp 6.5 PowerShell SDK Download
Webster
April 3, 2014 at 3:37 am
i can confirm in my our new XA64 Farm with 140 Servers runs the script very slow after 2 Minutes. Now the script runs 26 Hours. I can see the script is slow by check the server status.
April 3, 2014 at 4:23 am
ok, think i have an workaround for the slow issue on my system. When the script hangs on one server check, i start MS Word manuall an close word. Now the script run normal.
February 27, 2015 at 4:22 am
Hi,
its strange but it was taking around 20 hours to scan 20 servers for me – so i have decided to run it as a scheduled task (run as my admin account) – which lead me to another problem causing the script to hangs on “loading word templates” verbose message – as a work around I’ve created Desktop directory according to this post (http://stackoverflow.com/questions/1674836/how-to-run-a-windows-2008-task-from-the-scheduler-with-interact-with-desktop) – so when i was finaly able to run it as a task it seems to work much faster when i’m not loged in than runing it from interactive console after loging to xenapp server….
December 17, 2013 at 9:46 am
Hi, I’m realy interested in your script. Issue now, the script is running about 2 hours and only one server is done. 🙁
Is it normal that the script is running so slow?
December 17, 2013 at 9:54 am
What version of the script are you running?
Did you run with -verbose?
Are you running on a Controller or remotely?
What version of Word? Word 2013 is 66% slower than Word 2007 and 40% slower than Word 2010.
Thanks
Webster
January 28, 2014 at 3:54 am
I’m running in the same problem. The document generated is very good and I would love to schedule it on a weekly basis.
The only problem, the script takes ages to execute, but not every time.
Sometime it takes under 10 minutes, sometimes it takes 8 hours !
I’m using the verbose mode with or without -hardware and -software switches regardless.
I can see it’s very slow when it starts processing “Gather session sharing info for Appendix A”.
I’m running the script directly on my Citrix XA 6.5 server with Office 2010 installed.
Here’s a bit of the log when it starts to get slow:
VERBOSE: 01/28/2014 10:38:05: Processing application
VERBOSE: 01/28/2014 10:38:05: Gather session sharing info for Appendix A
VERBOSE: 01/28/2014 10:38:09: Max length of server name is 15
VERBOSE: 01/28/2014 10:39:07: Move table to the right
VERBOSE: 01/28/2014 10:39:10: Return focus back to document
VERBOSE: 01/28/2014 10:39:26: Move to the end of the current document
VERBOSE: 01/28/2014 10:39:33: Processing application
VERBOSE: 01/28/2014 10:39:33: Gather session sharing info for Appendix A
VERBOSE: 01/28/2014 10:39:38: Max length of server name is 26
VERBOSE: 01/28/2014 10:40:36: Move table to the right
VERBOSE: 01/28/2014 10:40:40: Return focus back to document
VERBOSE: 01/28/2014 10:40:56: Move to the end of the current document
VERBOSE: 01/28/2014 10:40:57: Processing application
VERBOSE: 01/28/2014 10:40:57: Gather session sharing info for Appendix A
VERBOSE: 01/28/2014 10:41:02: Max length of server name is 26
Thanks in advance for your help.
January 28, 2014 at 5:20 pm
I am aware of the issue. It has never happened to me on any of the hundreds of servers I have run the scripts on over the last three years. I have several reports of this slowness issue. I do plan on spending some time, eventually, on finding a solution. It would be nice to be able to get remote access into a server experiencing the issue and run ISE and step through the code at the slow points to see what is going on. Before the slow points the data has already been gathered and the table has been pre-created with the proper number of columns and rows. What happens next is just a simple loop that says place this piece of data from an array into this cell in the table. I have absolutely no idea why, for some people, that process can take minutes per cell.
Thanks
Webster
November 11, 2013 at 10:19 am
I’m receiving the error below while running the script . XenApp 6.5 farm is built in windows 2012 AD.
WARNING: XXXXXXX is not readable by this XenApp 6.5 server
WARNING: XXXXXXX was probably created by an updated Citrix Group Policy Provider
November 11, 2013 at 4:56 pm
That simply means that the AD Group Policy with the name “XXXXXXX” was created by a Citrix product that your installed Citrix XenApp 6.5 Group Policy Provider does not know how to handle. That could be a XenDesktop created policy for example.
Webster
May 26, 2013 at 1:04 am
Carl,
I was trawling the net trying to learn some PowerShell bit and bobs to help with a proof of concept deployment I am tinkering with when I came accross your scrpit. Wow!!! you blow my mind. I ran the script against my PoC and have ended up with a document that could form the basis of a build document for future deployments.
I just wanted to right a note and say thankyou and very well done.
It would be interesting if the output data could be fed into MS Visio to have it automate a drawing of an infrastructure, but that is way beyond my skills.
Cheers
Leon (UK)
March 19, 2013 at 9:37 pm
Thanks for the outstanding effort Webster!
Can we safely run the script in Powershell V3 environment without any caveats?
Thank you
March 20, 2013 at 5:02 am
I don’t believe so. I believe there are a couple of issues running the script in V3. I have not tested any of my scripts with V3.
Webster
March 12, 2013 at 2:17 pm
Thank you Mr. Webster!
I ran the following to append my Citrix Group Policy Settings to the file.
Import-Module .\CitrixGPOPS\Citrix.GroupPolicy.Commands.psm1
New-PSDrive -Name CitrixGPO -PSProvider CitrixGroupPolicy -Root \ -Domain “NAME OF GPO with CITRIX SETTINGS”
Get-CTXGroupPolicy -PolicyName “*” -DriveName CitrixGPO |out-file .\XA65Farm.txt -append
Get-CTXGroupPolicyConfiguration -PolicyName “*” -ConfiguredOnly -DriveName CitrixGPO |out-file .\XA65Farm.txt -append
Remove-PSDrive -Name CitrixGPO
January 21, 2013 at 4:46 pm
Hi Carl,
Great article and amazing script – thanks for your efforts!
One question – when I run the script, it executes and runs to completion. When it processes the policies section, it only
returns the unfiltered policies. We have our Citrix policies stored within group policy. I am running the script from one of our ZDC’s and am unsure where I should check…
January 21, 2013 at 4:48 pm
The script can only process Citrix IMA based policies. I have not been able to figure out how to use the Citrix provided policy module to gather data on Active Directory based polcies.
Webster
January 21, 2013 at 6:43 pm
Cheers Carl – thanks for the clarification! Still a great tool to have!
October 22, 2012 at 9:21 am
This is by far the best thing i have seen around XenApp by an individual outside Citrix 🙂
Cheers
July 9, 2012 at 11:03 am
Thanks a lot Carl. I had the same type of a complete inventory script built out for our 5.0 infrastructure, and in the process of looking for 6.5 updates stumbled on your script, and since it’s so complete I won’t even need to do much of an update.
Thanks a lot
Alex
June 14, 2012 at 9:04 am
Many thanks. I was struggling with listing all the servernames of a workergroup and this helped!
February 24, 2012 at 4:15 am
Hi Carl,
Thanks for this article and scripts, very, very useful.
Sean
February 22, 2012 at 2:49 pm
Awesome!
February 17, 2012 at 9:51 am
An amazing find, thanks for publishing this. It has saved me a lot of time on my final documentation to the client. I had to right click the psm1 files, choose properties and press the unblock button in order for them to work. Also run Set-ExecutionPolicy RemoteSigned as well.
December 5, 2011 at 7:22 pm
Carl – Just wanted to say thank you very much for this article and your hard work. Much appreciated.
December 6, 2011 at 9:12 am
Thanks for the kind words Adam.
Webster
October 11, 2011 at 12:40 pm
Wow, just wow.
You did some heavy lifting, Carl.
Congratulations and thank you.