Archive: ‘Powershell’ Category

Create a Set of Default Applications

No comments October 2nd, 2010

Where I work we create a default set of applications to all of our customers. So I wrote this script to do it for me. It can easily be customized to anyones needs if someone wants something similar. This is for Xenapp 6 and needs to be modified to run on Xenapp 5.

Download


cls
Write-Host
Write-Host
Write-Host "#########################################################################################"
Write-Host "## Before you run this scripte there are a few thing you need to have create before. ##"
Write-host "## 1. The officeremotedesktopusers group of the company. ##"
Write-Host "## 2. The officeusers group. ##"
write-host "## 3. a workergroup named after the company. ##"
Write-Host "## 4. And a folder named after the company in the citrix console. ##"
Write-Host "## ##"
Write-Host "## Written By Roger Eklund (gobba@sajberhagen.com) ##"
Write-Host "#########################################################################################"
Write-Host
Write-Host
Write-Host "Allright Lets Start!"
Write-Host
Write-Host "Company name:(Demo) " -NoNewline
$Company = read-host
Write-Host "Upn Suffix:(demo.org) " -NoNewline
$Upn = Read-Host
Write-Host "Server Where applications is installed:(servername) " -NoNewline
$Server = Read-Host

# Desktop
New-XAApplication -ApplicationType "ServerDesktop" -DisplayName "Desktop" -Description "$Company Desktop" -FolderPath "Applications/$Company" -BrowserName "$Company Desktop"
Add-XAApplicationWorkerGroup -BrowserName "$Company Desktop" -WorkerGroupNames $Company
Add-XAApplicationAccount -BrowserName "$Company Desktop" -Accounts "OfficeRemoteDesktopUsers@$Upn"

# Word
$icon = Get-CtxIcon "\\$Server\C$\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Word" -Description "$Company Word" -FolderPath "Applications/$Company" -BrowserName "$Company Word" -CommandLineExecutable '"C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"' -WorkingDirectory "C:\Program Files (x86)\Microsoft Office\Office12" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Word" -Accounts "OfficeUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Word" -WorkerGroupNames $Company

# Excel
$icon = Get-CtxIcon "\\$Server\C$\Program Files (x86)\Microsoft Office\Office12\excel.EXE" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Excel" -Description "$Company Excel" -FolderPath "Applications/$Company" -BrowserName "$Company Excel" -CommandLineExecutable '"C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"' -WorkingDirectory "C:\Program Files (x86)\Microsoft Office\Office12" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Excel" -Accounts "OfficeUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Excel" -WorkerGroupNames $Company

# Outlook
$icon = Get-CtxIcon "\\$Server\C$\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Outlook" -Description "$Company Outlook" -FolderPath "Applications/$Company" -BrowserName "$Company Outlook" -CommandLineExecutable '"C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE"' -WorkingDirectory "C:\Program Files (x86)\Microsoft Office\Office12" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Outlook" -Accounts "OfficeUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Outlook" -WorkerGroupNames $Company

# Powerpoint
$icon = Get-CtxIcon "\\$Server\C$\Program Files (x86)\Microsoft Office\Office12\POWERPNT.EXE" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Powerpoint" -Description "$Company Powerpoint" -FolderPath "Applications/$Company" -BrowserName "$Company Powerpoint" -CommandLineExecutable '"C:\Program Files (x86)\Microsoft Office\Office12\POWERPNT.EXE"' -WorkingDirectory "C:\Program Files (x86)\Microsoft Office\Office12" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Powerpoint" -Accounts "OfficeUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Powerpoint" -WorkerGroupNames $Company

# Explorer
$icon = Get-CtxIcon "C:\Windows\explorer.exe" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Explorer" -Description "$Company Explorer" -FolderPath "Applications/$Company" -BrowserName "$Company Explorer" -CommandLineExecutable '"C:\Program Files\Internet Explorer\iexplore.exe" -e h:\' -WorkingDirectory "%windir%" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Explorer" -Accounts "OfficeRemoteDesktopUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Explorer" -WorkerGroupNames $Company

# Internet Explorer
$icon = Get-CtxIcon "C:\Program Files\Internet Explorer\iexplore.exe" -Index 0
New-XAApplication -ApplicationType "ServerInstalled" -DisplayName "Internet Explorer" -Description "$Company Internet Explorer" -FolderPath "Applications/$Company" -BrowserName "$Company Internet Explorer" -CommandLineExecutable "C:\Program Files\Internet Explorer\iexplore.exe" -WorkingDirectory "C:\Program Files (x86)\Internet Explorer\" -EncodedIconData $icon
Add-XAApplicationAccount -BrowserName "$Company Internet Explorer" -Accounts "OfficeRemoteDesktopUsers@$Upn"
Add-XAApplicationWorkerGroup -BrowserName "$Company Internet Explorer" -WorkerGroupNames $Company