Free Consultation

PowerShell XenApp Application Report

So, I am not a scripter and I am just getting to grips with powershell but I thought I would share this script that I have created in case anyone finds it useful.

Probably it could be written better but it works.

This script will get your list of published apps, run a report against them, and then export it to a .csv file in the Documents folder of the logged on user.

#*FileName: XenApp_Published_App_Report.ps1
#*=========================================
#*Created 07/06/2012
#*Author: Shaun Ritchie
#*www.shaunritchie.co.uk
#*
#*
#*
#*=========================================
#*
#*
#*
#*=========================================
#* SCRIPT BODY
#*=========================================
# Load XenApp cmdlets

add-pssnapin Citrix.* -erroraction silentlycontinue
# Create variables

$outpath = [environment]::getfolderpath(“mydocuments”) + “XenApp_Published_App_Report.csv”
$xaapplist = get-xaapplication
$appreport=foreach ($application in $xaapplist) {

get-xaapplicationreport -BrowserName $application.BrowserName

}

# pipe appreport variable and select required objects for output
$appreport |
select-object BrowserName,
applicationtype,
enabled,
@{n=’accounts’; e={$_.accounts}},
@{n=’servernames’; e={$_.servernames}},
@{n=’workergroupnames’; e={$_.workergroupnames}},
folderpath,
commandlineexecutable,
clientfolder,
startmenufolder,
encryptionlevel,
encryptionrequired,
windowtype,
colordepth |

#Export results to a CSV

export-csv $outpath