Friday, June 17, 2011

Powershell: Adding servers to published applications and publishing new application

Following Powershell script can be used to add servers to existing published application. Also this script will create and publish new applications.

CLS
Add-PSSnapin Citrix.*


###################################################
# Adding server to existing published applications
###################################################


Add-XAApplicationServer -BrowserName “Word 2003” -ServerNames "XENAPP2"
Add-XAApplicationServer -BrowserName “Excel 2003” -ServerNames "XENAPP2"
Add-XAApplicationServer -BrowserName “PowerPoint 2003” -ServerNames "XENAPP2"


##############################################
# Publishing new applications
##############################################


# Publishing MICROSOFT WORD 2003
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Word 2003" -FolderPath "Applications/General Applications" -BrowserName "Microsoft Word 2003" -Enabled $true -CommandLineExecutable "c:\program files\microsoft office\OFFICE11\WINWORD.exe" -WorkingDirectory "c:\program files\microsoft office\OFFICE11" -AnonymousConnectionsAllowed $false -AddToClientStartMenu $false -InstanceLimit "-1" -WindowType "1024x768" -ColorDepth "Colors256" -ClientFolder "General Apps" -WaitOnPrinterCreation $false

#Add servers to the application
Add-XAApplicationServer -BrowserName "Microsoft Word 2003" -ServerNames "XENAPP1", "XENAPP2"

#Add users to the application
Add-XAApplicationAccount -BrowserName "Microsoft Word 2003" -Accounts "KOLKATA\Domain Users", "KOLKATA\Binayak"

# Publishing NOTEPAD
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Notepad" -FolderPath "Applications/Server Testing" -BrowserName "Notepad" -Enabled $true -CommandLineExecutable "c:\windows\system32\notepad.exe" -WorkingDirectory "C:\Windows\system32" -AnonymousConnectionsAllowed $false -AddToClientStartMenu $false -InstanceLimit "-1" -WindowType "1024x768" -ColorDepth "Colors256" -ClientFolder "Testing" -WaitOnPrinterCreation $false

#Add server to the application
Add-XAApplicationServer -BrowserName "Notepad" -ServerNames "XENAPP2"


#Add users to the application

Add-XAApplicationAccount -BrowserName "Notepad" -Accounts "KOLKATA\Domain Users", "KOLKATA\Binayak"

ECHO "Done" 

1 comment:

  1. Adding new Severe to published application under folder


    1) Add-PSSnapin citrix.*
    2) Get-XAApplication -FolderPath APPLICATIONS\foldername | Add-XAApplicationServer -ServerNames "servername1", “servername2”

    ReplyDelete