• Documenting Citrix XenApp and XenDesktop 7.x with Microsoft PowerShell

    After 20 months of tortuous effort, over 22000 painful lines of PowerShell, over 800 hours of my time and with the help of over 150 testers, we are pleased to present you with Version 1.0 of the XenApp/XenDesktop 7.x documentation script.

    I would also like to thank the engineers at Citrix who helped me figure out how to retrieve and gather some data I just couldn’t find and also verify the way I gathered some data was indeed correct.

    The script has been tested with all versions of XenDesktop 7:

    • 7.0
    • 7.1
    • 7.5
    • 7.6
    • 7.6 FP1

    This is the second publicly released script that generates output in four formats:

    1. Microsoft Word 2010 and 2013
    2. PDF
    3. Formatted Text
    4. HTML

    As far as I know, this script documents every nook and cranny in Citrix Studio that I can find. The following is documented:

    • Machines Catalogs
      • Optionally, details on every machine in every catalog
    • Delivery Groups
      • Optionally, details on every machine (desktop) in every group
    • Applications
      • Optionally, details for every application
    • Policies
      • Optionally, details for every XenDesktop 7.x Site and Active Directory (AD) based Citrix policy
    • Logging
    • Site Configuration
    • Administrators
    • Controllers
    • Hosting
      • Optionally, basic details for every machine using a hosting connection
    • Licensing
    • StoreFront
    • App-V Publishing

    When a machine catalog or delivery group is double-clicked in Studio a list of machines in that catalog or group are shown. If you right-click on the column header row and click Select Columns, there are a lot of columns to chose from as shown in Figure 1.

    Figure 1
    Figure 1

    I decided to include every column in the optional machine details. The same details are also used for delivery groups. If you decide to use both machine catalog details and delivery group details, your report will be extremely long and take an exceptionally long time to run. I recommend you chose one or neither.

    This is now the largest script I have written at just over 22,000 lines! I hope you enjoy what I and the over 150 testers have created for you.

    The script has extremely detailed help text to explain all the parameters.

    .SYNOPSIS
    	Creates an inventory of a Citrix XenDesktop 7.x Site.
    .DESCRIPTION
    	Creates an inventory of a Citrix XenDesktop 7.x Site using Microsoft PowerShell, Word,
    	plain text or HTML.
    	
    	Script requires at least PowerShell version 3 but runs fastest in version 5.
    
    	Word is NOT needed to run the script. This script will output in Text and HTML.
    	
    	You do NOT have to run this script on a Controller. This script was developed and run 
    	from a Windows 8.1 VM.
    	
    	You can run this script remotely using the –AdminAddress (AA) parameter.
    	
    	By default, only gives summary information for:
    		Machine Catalogs
    		Delivery Groups
    		Applications
    		Policies
    		Logging
    		Hosting
    		StoreFront
    
    	The Summary information is what is shown in the top half of Citrix Studio for:
    		Machine Catalogs
    		Delivery Groups
    		Applications
    		Policies
    		Logging
    		Hosting
    		StoreFront
    
    	Using the MachineCatalogs parameter can cause the report to take a very long time to complete 
    	and can generate an extremely long report.
    	
    	Using the DeliveryGroups parameter can cause the report to take a very long time to complete 
    	and can generate an extremely long report.
    
    	Using both the MachineCatalogs and DeliveryGroups parameters can cause the report to take an
    	extremely long time to complete and generate an exceptionally long report.
    
    	Creates an output file named after the XenDesktop 7.x Site.
    	
    	Word and PDF Document includes a Cover Page, Table of Contents and Footer.
    	Includes support for the following language versions of Microsoft Word:
    		Catalan
    		Danish
    		Dutch
    		English
    		Finnish
    		French
    		German
    		Norwegian
    		Portuguese
    		Spanish
    		Swedish
    		
    .PARAMETER CompanyName
    	Company Name to use for the Cover Page.  
    	Default value is contained in HKCU:\Software\Microsoft\Office\Common\UserInfo\CompanyName or
    	HKCU:\Software\Microsoft\Office\Common\UserInfo\Company, whichever is populated on the 
    	computer running the script.
    	This parameter has an alias of CN.
    .PARAMETER CoverPage
    	What Microsoft Word Cover Page to use.
    	Only Word 2010 and 2013 are supported.
    	(default cover pages in Word en-US)
    	
    	Valid input is:
    		Alphabet (Word 2010. Works)
    		Annual (Word 2010. Doesn't work well for this report)
    		Austere (Word 2010. Works)
    		Austin (Word 2010/2013. Doesn't work in 2013, mostly works in 2010 but 
    						Subtitle/Subject & Author fields need to be moved 
    						after title box is moved up)
    		Banded (Word 2013. Works)
    		Conservative (Word 2010. Works)
    		Contrast (Word 2010. Works)
    		Cubicles (Word 2010. Works)
    		Exposure (Word 2010. Works if you like looking sideways)
    		Facet (Word 2013. Works)
    		Filigree (Word 2013. Works)
    		Grid (Word 2010/2013.Works in 2010)
    		Integral (Word 2013. Works)
    		Ion (Dark) (Word 2013. Top date doesn't fit, box needs to be manually resized or font 
    						changed to 8 point)
    		Ion (Light) (Word 2013. Top date doesn't fit, box needs to be manually resized or font 
    						changed to 8 point)
    		Mod (Word 2010. Works)
    		Motion (Word 2010/2013. Works if top date is manually changed to 36 point)
    		Newsprint (Word 2010. Works but date is not populated)
    		Perspective (Word 2010. Works)
    		Pinstripes (Word 2010. Works)
    		Puzzle (Word 2010. Top date doesn't fit, box needs to be manually resized or font 
    					changed to 14 point)
    		Retrospect (Word 2013. Works)
    		Semaphore (Word 2013. Works)
    		Sideline (Word 2010/2013. Doesn't work in 2013, works in 2010)
    		Slice (Dark) (Word 2013. Doesn't work)
    		Slice (Light) (Word 2013. Doesn't work)
    		Stacks (Word 2010. Works)
    		Tiles (Word 2010. Date doesn't fit unless changed to 26 point)
    		Transcend (Word 2010. Works)
    		ViewMaster (Word 2013. Works)
    		Whisp (Word 2013. Works)
    		
    	Default value is Sideline.
    	This parameter has an alias of CP.
    .PARAMETER UserName
    	User name to use for the Cover Page and Footer.
    	Default value is contained in $env:username
    	This parameter has an alias of UN.
    .PARAMETER AdminAddress
    	Specifies the address of a XenDesktop controller the PowerShell snapins will connect to. 
    	This can be provided as a host name or an IP address. 
    	This parameter defaults to LocalHost.
    	This parameter has an alias of AA.
    .PARAMETER PDF
    	SaveAs PDF file instead of DOCX file.
    	This parameter is disabled by default.
    	The PDF file is roughly 5X to 10X larger than the DOCX file.
    .PARAMETER Text
    	Creates a formatted text file with a .txt extension.
    	This parameter is disabled by default.
    .PARAMETER MSWord
    	SaveAs DOCX file
    	This parameter is set True if no other output format is selected.
    .PARAMETER HTML
    	Creates an HTML file with an .html extension.
    	This parameter is disabled by default.
    .PARAMETER MachineCatalogs
    	Gives detailed information for all machines in all Machine Catalogs.
    	
    	Using the MachineCatalogs parameter can cause the report to take a very long 
    	time to complete and can generate an extremely long report.
    	
    	Using both the MachineCatalogs and DeliveryGroups parameters can cause the 
    	report to take an extremely long time to complete and generate an exceptionally 
    	long report.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of MC.
    .PARAMETER DeliveryGroups
    	Gives detailed information for all desktops in all Desktop (Delivery) Groups.
    	
    	Using the DeliveryGroups parameter can cause the report to take a very long 
    	time to complete and can generate an extremely long report.
    	
    	Using both the MachineCatalogs and DeliveryGroups parameters can cause the 
    	report to take an extremely long time to complete and generate an exceptionally 
    	long report.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of DG.
    .PARAMETER DeliveryGroupsUtilization
    	Gives a chart with the delivery group utilization for the last 7 days 
    	depending on the information in the database.
    	
    	This option is only available when the report is generated in Word and requires 
    	Micosoft Excel to be locally installed.
    	
    	Using the DeliveryGroupsUtilization parameter causes the report to take a longer time to 
    	complete and generates a longer report.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of DGU.
    .PARAMETER Applications
    	Gives detailed information for all applications.
    	This parameter is disabled by default.
    	This parameter has an alias of Apps.
    .PARAMETER Policies
    	Give detailed information for both Site and Citrix AD based Policies.
    	
    	Using the Policies parameter can cause the report to take a very long time 
    	to complete and can generate an extremely long report.
    	
    	There are three related parameters: Policies, NoPolicies and NoADPolicies.
    	
    	Policies and NoPolicies are mutually exclusive and priority is given to NoPolicies.
    	
    	Using both Policies and NoADPolicies results in only policies created in Studio
    	being in the output document.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of Pol.
    .PARAMETER NoPolicies
    	Excludes all Site and Citrix AD based policy information from the output document.
    	
    	Using the NoPolicies parameter will cause the Policies parameter to be set to False.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of NP.
    .PARAMETER NoADPolicies
    	Excludes all Citrix AD based policy information from the output document.
    	Includes only Site policies created in Studio.
    	
    	This switch is useful in large AD environments, where there may be thousands
    	of policies, to keep SYSVOL from being searched.
    	
    	This parameter is disabled by default.
    	This parameter has an alias of NoAD.
    .PARAMETER Logging
    	Give the Configuration Logging report with, by default, details for the previous seven days.
    	This parameter is disabled by default.
    	This parameter has an alias of Log.
    .PARAMETER Hosting
    	Give detailed information for Hosts, Host Connections and Resources.
    	This parameter is disabled by default.
    	This parameter has an alias of Host.
    .PARAMETER StartDate
    	Start date for the Configuration Logging report.
    	
    	Format for date only is MM/DD/YYYY.
    	
    	Format to include a specific time range is "MM/DD/YYYY HH:MM:SS" in 24 hour format.
    	The double quotes are needed.
    	
    	Default is today's date minus seven days.
    	This parameter has an alias of SD.
    .PARAMETER EndDate
    	End date for the Configuration Logging report.
    	
    	Format for date only is MM/DD/YYYY.
    	
    	Format to include a specific time range is "MM/DD/YYYY HH:MM:SS" in 24 hour format.
    	The double quotes are needed.
    	
    	Default is today's date.
    	This parameter has an alias of ED.
    .PARAMETER StoreFront
    	Give detailed information for StoreFront.
    	This parameter is disabled by default.
    	This parameter has an alias of SF.
    .PARAMETER AddDateTime
    	Adds a date time stamp to the end of the file name.
    	Time stamp is in the format of yyyy-MM-dd_HHmm.
    	June 1, 2015 at 6PM is 2015-06-01_1800.
    	Output filename will be ReportName_2015-06-01_1800.docx (or .pdf).
    	This parameter is disabled by default.
    	This parameter has an alias of ADT.
    .PARAMETER Hardware
    	Use WMI to gather hardware information on: Computer System, Disks, Processor and Network 
    	Interface Cards
    
    	This parameter may require the script be run from an elevated PowerShell session 
    	using an account with permission to retrieve hardware information (i.e. Domain Admin or 
    	Local Administrator).
    
    	Selecting this parameter will add to both the time it takes to run the script and size 
    	of the report.
    
    	This parameter is disabled by default.
    	This parameter has an alias of HW.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1
    	
    	Will use all default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    	The computer running the script for the AdminAddress.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -AdminAddress DDC01
    	
    	Will use all default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    	DDC01 for the AdminAddress.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -PDF
    	
    	Will use all default values and save the document as a PDF file.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    	The computer running the script for the AdminAddress.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -TEXT
    
    	Will use all default values and save the document as a formatted text file.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -HTML
    
    	Will use all default values and save the document as an HTML file.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -MachineCatalogs
    	
    	Creates a report with full details for all machines in all Machine Catalogs.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -DeliveryGroups
    	
    	Creates a report with full details for all desktops in all Desktop (Delivery) Groups.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -DeliveryGroupsUtilization
    	
    	Creates a report with utilization details for all Desktop (Delivery) Groups.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -DeliveryGroups -MachineCatalogs
    	
    	Creates a report with full details for all machines in all Machine Catalogs and 
    	all desktops in all Delivery Groups.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Applications
    	
    	Creates a report with full details for all applications.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Policies
    	
    	Creates a report with full details for Policies.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -NoPolicies
    	
    	Creates a report with no Policy information.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -NoADPolicies
    	
    	Creates a report with no Citrix AD based Policy information.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Policies -NoADPolicies
    	
    	Creates a report with full details on Site policies created in Studio but 
    	no Citrix AD based Policy information.
    	
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Logging -StartDate 01/01/2015 -EndDate 01/31/2015
    	
    	Creates a report with Configuration Logging details for the dates 01/01/2015 through 
    	01/31/2015.
    	
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Logging -StartDate "06/01/2015 10:00:00" -EndDate "06/01/2015 14:00:00"
    	
    	Creates a report with Configuration Logging details for the time range 
    	06/01/2015 10:00:00AM through 06/01/2015 02:00:00PM.
    	
    	Narrowing the report down to seconds does not work. Seconds must be either 00 or 59.
    	
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Hosting
    	
    	Creates a report with full details for Hosts, Host Connections and Resources.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -StoreFront
    	
    	Creates a report with full details for StoreFront.
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -MachineCatalogs -DeliveryGroups -Applications -Policies -Hosting -StoreFront
    	
    	Creates a report with full details for all:
    		Machines in all Machine Catalogs
    		Desktops in all Delivery Groups
    		Applications
    		Policies
    		Hosts, Host Connections and Resources
    		StoreFront
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -MC -DG -Apps -Policies -Hosting
    	
    	Creates a report with full details for all:
    		Machines in all Machine Catalogs
    		Desktops in all Delivery Groups
    		Applications
    		Policies
    		Hosts, Host Connections and Resources
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .EXAMPLE
    	PS C:\PSScript .\XD7_Inventory.ps1 -CompanyName "Carl Webster Consulting" -CoverPage "Mod" -UserName "Carl Webster" -AdminAddress DDC01
    
    	Will use:
    		Carl Webster Consulting for the Company Name.
    		Mod for the Cover Page format.
    		Carl Webster for the User Name.
    		Controller named DDC01 for the AdminAddress.
    .EXAMPLE
    	PS C:\PSScript .\XD7_Inventory.ps1 -CN "Carl Webster Consulting" -CP "Mod" -UN "Carl Webster"
    
    	Will use:
    		Carl Webster Consulting for the Company Name (alias CN).
    		Mod for the Cover Page format (alias CP).
    		Carl Webster for the User Name (alias UN).
    		The computer running the script for the AdminAddress.
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -AddDateTime
    	
    	Will use all Default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    
    	Adds a date time stamp to the end of the file name.
    	Time stamp is in the format of yyyy-MM-dd_HHmm.
    	June 1, 2015 at 6PM is 2015-06-01_1800.
    	Output filename will be XD7SiteName_2015-06-01_1800.docx
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -PDF -AddDateTime
    	
    	Will use all Default values and save the document as a PDF file.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    
    	Adds a date time stamp to the end of the file name.
    	Time stamp is in the format of yyyy-MM-dd_HHmm.
    	June 1, 2015 at 6PM is 2015-06-01_1800.
    	Output filename will be XD7SiteName_2015-06-01_1800.pdf
    .EXAMPLE
    	PS C:\PSScript > .\XD7_Inventory.ps1 -Hardware
    	
    	Will use all default values.
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl Webster" or
    	HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl Webster"
    	$env:username = Administrator
    
    	Carl Webster for the Company Name.
    	Sideline for the Cover Page format.
    	Administrator for the User Name.
    .INPUTS
    	None.  You cannot pipe objects to this script.
    .OUTPUTS
    	No objects are output from this script.  This script creates a Word, PDF
    	plain text or HTML document.
    .NOTES
    	NAME: XD7_Inventory.ps1
    	VERSION: 1.00
    	AUTHOR: Carl Webster
    	LASTEDIT: June 12, 2015
    
    

    I know that no matter how many testers I have testing the script, it takes real world use to find all the bugs and little things that were overlooked. If you find a bug, an issue, a typo, some data I missed in Studio or have an enhancement request, send me an email to webster@carlwebster.com.

    As I get time, I will write up an article for each section of the script detailing what is involved in getting each section documented.

    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/

    Thanks and enjoy

    Webster







    About Carl Webster

    Webster is a Sr. Solutions Architect for Choice Solutions, LLC and specializes in Citrix, Active Directory and Technical Documentation. Webster has been working with Citrix products for many years starting with Multi-User OS/2 in 1990.

    View all posts by Carl Webster

    17 Responses to “Documenting Citrix XenApp and XenDesktop 7.x with Microsoft PowerShell”

    1. Ozzie Castillo Says:

      Hello Carl,

      When trying to run the script, I’m getting the error below as it’s unable to save the file – actual file name removed for privacy reasons:

      Thank you in advance for any assistance. Great job with the script!

      Ozzie
      ____________

      WARNING: 05/17/2016 13:48:46: Unable to save the output file, c:\Vancouver.html
      ProcessDocumentOutput : Unable to save the output file, c:\.html
      At C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\Citrix.GroupPolicy.Commands\XD7_Inventory_Signed.ps1:25905 char:1
      + ProcessDocumentOutput
      + ~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,ProcessDocumentOutput

      Reply

      • Carl Webster Says:

        That bug was fixed in the most recent update to the script, version 1.20.

        https://carlwebster.com/downloads/download-info/xenappxendesktop-7-x-documentation-script/

        Webster

        Reply

        • Ozzie Castillo Says:

          Yeah, that’s the one I’m using – XenDesktop7V1.20.

          Reply

        • Ozzie Castillo Says:

          Carl, I found out what the issue was. I had to run PowerShell *explicitly* as Administrator. That solved the issue. Thanks for the help, really appreciated.

          Ozzie

          Reply

          • Carl Webster Says:

            That is NOT required to run the script. I would like to at least see the output from the -SI parameter.

            Thanks

            Webster

            Reply

        • Ozzie Castillo Says:

          This is the output of the XAXD7V1InventoryScriptErrors_2016-05-17_1423.txt file, however the script ran with no issues:

          Import-Module : The specified module ‘Citrix.GroupPolicy.Commands’ was not loaded because no valid module file was
          found in any module directory.
          At C:\XD7_Inventory_Signed.ps1:4683 char:13
          + $module = Import-Module -Name $ModuleName -PassThru -EA 0 4>$Null
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : ResourceUnavailable: (Citrix.GroupPolicy.Commands:String) [Import-Module], FileNotFoundE
          xception
          + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

          Import-Module : The specified module ‘Citrix.GroupPolicy.Commands’ was not loaded because no valid module file was
          found in any module directory.
          At C:\XD7_Inventory_Signed.ps1:4683 char:13
          + $module = Import-Module -Name $ModuleName -PassThru -EA 0 4>$Null
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : ResourceUnavailable: (Citrix.GroupPolicy.Commands:String) [Import-Module], FileNotFoundE
          xception
          + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

          Reply

          • Carl Webster Says:

            Those I am not worried about. They mean you haven’t copied the citrix.groupolicy.commands module file to that computer. That is not a big deal unless you want policies included in your report.

            Webster

            Reply

    2. Magnus Says:

      hey Carl
      I am trying to run this on a 7.6 DDC and running the -PDF option I get this
      —————
      PS N:\stuff\Citrix\Xd7.6 Documetaion Script> .\XD7_Inventory.ps1 -PDF
      VERBOSE: 07/08/2015 09:15:17: Testing output parameters
      VERBOSE: 07/08/2015 09:15:17: PDF is set
      VERBOSE: 07/08/2015 09:15:17: CoName is
      VERBOSE: 07/08/2015 09:15:17: Gathering initial Site data
      VERBOSE: 07/08/2015 09:15:17: Initial Site data has been gathered

      This script directly outputs to Microsoft Word, please install Microsoft Word
      ———————–

      If I run it with with the HTML option with a few of the other options (i.e. machine catalogs …etc) i get the following

      ————————————————
      PS N:\stuff\Citrix\Xd7.6 Documetaion Script> .\XD7_Inventory.ps1 -html -MachineCatalogs -DeliveryGroups -Policies -Logg
      ng -Hosting -AddDateTime -Hardware -CompanyName “Millennium Partners”
      N:\stuff\Citrix\Xd7.6 Documetaion Script\XD7_Inventory.ps1 : Parameter set cannot be resolved using the specified
      named parameters.
      At line:1 char:1
      + .\XD7_Inventory.ps1 -html -MachineCatalogs -DeliveryGroups -Policies -Logging -H …
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidArgument: (:) [XD7_Inventory.ps1], ParameterBindingException
      + FullyQualifiedErrorId : AmbiguousParameterSet,XD7_Inventory.ps1

      ———————————————————————–

      ANy ideas as to why I am getting this?

      Reply

      • Carl Webster Says:

        The PDF option uses the Word SaveAs PDF capability.

        Webster

        Reply

      • Carl Webster Says:

        As explained in the help text, the CompanyName parameter is only used for the Word and PDF output options.

        PS C:\scripttesting> get-help .\XD7_Inventory.ps1

        NAME
        C:\scripttesting\XD7_Inventory.ps1

        SYNOPSIS
        Creates an inventory of a Citrix XenDesktop 7.x Site.

        SYNTAX
        C:\scripttesting\XD7_Inventory.ps1 [-MSWord] [-AdminAddress ] [-MachineCatalogs] [-DeliveryGroups]
        [-DeliveryGroupsUtilization] [-Applications] [-Policies] [-NoPolicies] [-NoADPolicies] [-Logging]
        [-Administrators] [-Hosting] [-StoreFront] [-StartDate ] [-EndDate ] [-AddDateTime]
        [-Hardware] [-CompanyName ] [-CoverPage ] [-UserName ] []

        C:\scripttesting\XD7_Inventory.ps1 [-PDF] [-AdminAddress ] [-MachineCatalogs] [-DeliveryGroups]
        [-DeliveryGroupsUtilization] [-Applications] [-Policies] [-NoPolicies] [-NoADPolicies] [-Logging]
        [-Administrators] [-Hosting] [-StoreFront] [-StartDate ] [-EndDate ] [-AddDateTime]
        [-Hardware] [-CompanyName ] [-CoverPage ] [-UserName ] []

        C:\scripttesting\XD7_Inventory.ps1 [-Text] [-AdminAddress ] [-MachineCatalogs] [-DeliveryGroups]
        [-DeliveryGroupsUtilization] [-Applications] [-Policies] [-NoPolicies] [-NoADPolicies] [-Logging]
        [-Administrators] [-Hosting] [-StoreFront] [-StartDate ] [-EndDate ] [-AddDateTime]
        [-Hardware] []

        C:\scripttesting\XD7_Inventory.ps1 [-HTML] [-AdminAddress ] [-MachineCatalogs] [-DeliveryGroups]
        [-DeliveryGroupsUtilization] [-Applications] [-Policies] [-NoPolicies] [-NoADPolicies] [-Logging]
        [-Administrators] [-Hosting] [-StoreFront] [-StartDate ] [-EndDate ] [-AddDateTime]
        [-Hardware] []

        I will add additional information to the help text to make this clearer.

        Thanks

        Webster

        Reply

    3. Mark Says:

      Carl,
      I ran your script and it exports beautifully. However, Is there a parameter that allows for showing limiting visibility? I have specific applications that are not shown to the whole delivery group. I need to generate a report for all the applications in our 7.6 farm as well as the specific groups/users who can see that application.

      I have done this with my 6.5 farm using:
      Get-XAApplicationReport * | select @{n=”Servers”;e={[string]::join(” ; “, $_.ServerNames)}}, DisplayName, Description, @{n=”Users”;e={[string]::join(” ; “, $_.Accounts)}} | Export-Csv C:\Xenapp6-.csv

      Is there something similar for 7.6?
      Thanks again!

      Reply

      • Carl Webster Says:

        That is already in the script.

        $xVisibility = @()
        If($Application.UserFilterEnabled)
        {
        $cnt = -1
        ForEach($tmp in $Application.AssociatedUserFullNames)
        {
        $cnt++
        $xVisibility += “$($tmp) ($($Application.AssociatedUserNames[$cnt]))”
        }
        }
        Else
        {
        $xVisibility = {Users inherited from Delivery Group}
        }

        An example from my lab:

        Citrix Studio Admin App Name
        Details
        Name (for administrator) : Citrix Studio Admin App Name
        Name (for user) : Citrix Studio App Name
        Description : Citrix Studio Desc
        Delivery Group : Win81 Pooled Random Desktop and Applications DG
        Folder (for administrators) :
        Folder (for user) :
        Visibility : User1 (LabADDomain\User1)
        Application Path : C:\Program Files\Citrix\Desktop Studio\LaunchConsole.exe
        Command line arguments :
        Working directory :
        Redirected file types :
        Tags :

        Calculator
        Details
        Name (for administrator) : Desktop Applications\Calculator
        Name (for user) : Calculator
        Description :
        Delivery Group : Win81 Apps DG
        Folder (for administrators) : Desktop Applications\
        Folder (for user) : AppCategory\Calculator
        Visibility : Users inherited from Delivery Group
        Application Path : C:\Windows\system32\calc.exe
        Command line arguments :
        Working directory :
        Redirected file types :
        Tags :

        Is that not what you need? If not, email me so we can discuss. Webster@carlwebster.com

        Thanks

        Webster

        Reply

    4. Dave Says:

      Error when run against remote DDC

      PS C:\XD7Script> .\XD7_Inventory.ps1-AdminAddress myDDC
      .\XD7_Inventory.ps1-AdminAddress : The term ‘.\XD7_Inventory.ps1-AdminAddress’ is not recognized as the name of a
      cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
      that the path is correct and try again.
      At line:1 char:1
      + .\XD7_Inventory.ps1-AdminAddress myDDC
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : ObjectNotFound: (.\XD7_Inventory.ps1-AdminAddress:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException

      Reply

    5. Arnaud PAIN Says:

      Thanks Carl for all the great job you made on your script.

      Amazing tools !!!

      Reply

    Leave a Reply