PowerShell script to create multiple published applications for testing

I created this small PowerShell script to create multiple published applications for testing server connectivity for each server in the imported list.

I use it for testing connectivity when setting up new farms. Rather than having one published notepad and changing the server in turn which can take ages, just create a load of notepads, test, and then delete.

servers.txt needs to be in your My Documents folder and you need to have a folder in your farm under Applications called Test Apps (or edit the script)

[code lang=”powershell”]
#*FileName: XenApp_Published_Notepads_.ps1
#*=========================================
#*Created 07/06/2012
#*Author: Shaun Ritchie
#*www.shaunritchie.co.uk
#*
#*
#*
#*=========================================
#*
#*
#*
#*=========================================
#* SCRIPT BODY
#*=========================================

add-pssnapin Citrix.* -erroraction silentlycontinue

$inpath = [environment]::getfolderpath(“mydocuments”) + “servers.txt”
$servers =get-content $inpath

foreach ($server in $servers) {

new-xaapplication -ApplicationType ServerInstalled -Displayname `
($server + ” – Notepad”) -FolderPath “Applications/Test Apps” `
-BrowserName ($server + ” – Notepad”) -Enabled $true -CommandLineExecutable “notepad.exe” `
-ServerNames $Server -Accounts domainusername }

[/code]

Comments

Be the first to comment!

Join the discussion