Citrix – Change wallpaper with powershell on a Citrix published desktop or Microsoft remote desktop

Summary

You publish Desktops with a Citrix XenApp/XenDesktop/Workspace or Microsoft Remote Desktop Services (RDS) environment and restrict your users with GPO to change any display settings, but your users want to change the background image/wallpaper?

Here is a method with PowerShell, that gives your users the flexibility back to upload an own  background image/wallpapers or choose from three default background wallpapers.

Description

The PowerShell script and the required images are saved in a subfolder in the program files path and can be started through a start menu or desktop shortcut. The PowerShell script generate a user friendly GUI that allows the users to upload an own image/wallpaper or choose from three different and pre- defined wallpapers.

You can find the complete Script and image structure here => SetWallpaper_20171004.

OK, let’s start…

First you must declare some variables and values to understand and use the following PowerShell script.

  • Location of the PowerShell script (script line 32) $ProgramPath (In my scenario, the powershell script and the images are saved in the program files path.)
  • Upload location for the own wallpaper (script line 33) $ProfilePath (Path to save the uploaded wallpaper image and the generated base64 thumbnail.)
  • Max file length for upload (script line 34) $MaxFileLength (restrict file size for upload.)
  • Wallpaper icon (script line 37) $WallpaperIcon (Filename of the icon, that show in the upper left corner of the PowerShell GUI.)
  • Wallpaper style (script line 38) $WallpaperStyle (Stretch or center the wallpaper)
  • Name of wallpaper file (script line 39-41) $WallpaperPict1, $WallpaperPict2, $WallpaperPict3 (The names of the wallpaper image files)

    The Features of the PowerShell script

  • Three different pre-defined background wallpapers to choose
  • Upload and set own background image/wallpaper
  • Automatically generate a thumbnail from own uploaded image/wallpaper as base64 file in the roaming user profile (Why a base64 file; The thumbnail must be changed while the PowerShell form are active and loaded. A picture are locked by the loaded PowerShell form and cannot be deleted or changed, but a base64 file can be deleted and changed when the PowerShell form are loaded.)
  • File size limitation for own uploaded image/wallpaper
  • Graphical user interface (GUI)
  • The PowerShell script read the actual session resolution and set the most fitting image/wallpaper from the source files

The GUI

The GUI are simple and easy to use.

Start PowerShell GUI over an desktop or start menu shortcut.
PowerShell GUI overview.

 Assistant to upload own background image/wallpaper.
 
Automatically generate a thumbnail from own uploaded image/wallpaper as base64 file in the roaming user profile.
 
 Thumbnail preview and set own background image/wallpaper.
 File size limitation for own uploaded image/wallpaper (the default file size upload limitation are 1MB and can be changed in the PowerShell script variables).
 Three different pre-defined background wallpapers to choose.

The PowerShell script

The script set your own uploaded or one of the three pre-defined background images/wallpaper on a Citrix published Desktop or Microsoft remote desktop.