Presentation given at Chicago CUGC Dec 2020, along with demos, explaining the why, what and how of automating various aspects of Citrix Virtual Apps and Desktops
(once automated) Save time & increase reliability of bulk/repeated operations Repeatability Eliminate human error (once you've tested scripts thoroughly) Scheduled tasks Easy to import/export to csv/xml/json and send emails & other methods of notification Large number of scripts and learning resources out there But check untrusted scripts before running them as admin on production systems! @guyrleech
(but don't use a Delivery Controller) PowerShell MSI files from CVAD ISO Remote PowerShell SDK (for Cloud ONLY) PVS (7.8 onwards) uses console dlls for modules Not available on PowerShell Gallery, etc @guyrleech
Set-PVSConnection (once) -MaxRecord count Cloud – create credential profile via downloaded secrets csv file But then most things are the same as on-premises, with some restrictions PowerShell view in Studio – helps you figure out the "how" (Legacy) Snapins versus Modules (latter from 1912 LTSR onwards) Account used to run @guyrleech
as a batch job" privilege) Test via (legacy) cmd.exe running as account set to run task Write a log file (Start-Transcript/Stop-Transcript) Use a single management machine ("jump box") Create separate task folders Notifications on success/failure Gotchas Single quotes Nested quotes (if all else fails, base64 encode the command line) Array flattening (resurrect with –split) $true/$false treated as string literals (use [switch] or [bool]::Parse() ) Easy to copy with PowerShell @guyrleech
Boundary conditions Bad input Scale What if ("no sane person should ever do this but …") Document – are comments in the code really enough? No Clear Text Passwords Annotate Error Handling & Reporting Change & Version Control Backup Systems before changing Scripts, config files, command lines, scheduled tasks Audit trail (Write-EventLog) @guyrleech