Citrix – Change DPI Scale, Font Size and Font Smoothing in a Citrix published desktop or Microsoft Remote Desktop with PowerShell

Summary

You publish Desktops and Applications with a Citrix XenApp/XenDesktop/Workspace or Microsoft Remote Desktop Services (RDS) environment on Microsoft Windows Server 2012 R2 or 2016 and restrict your users with GPO to change any display settings. But your users want to change the DPI Scale, Font Size or Font Smoothing? Here is a method with PowerShell, that gives your users the flexibility back to change the desired settings.

Description

The PowerShell script can be started from any desired location on your RDS server and produce a user friendly GUI, that allows the users to change three advanced display settings.

The Features of the PowerShell script

  • Three advanced display settings can changed
  • DPI Scaling (100, 125 and 150%)
  • Font Size (100, 125 and 150%)
  • Turn Font Smoothing On or Off
  • Display the actual Citrix session resolution
  • Display the actual configured advanced display settings
  • Graphical user interface (GUI)

The GUI

The GUI are simple and easy to use.

Start the PowerShell script over an desktop, start menu shortcut or published application.
Change the desired advanced display settings and press apply. Cancel close the PowerShell GUI dialog.
The session must be sign out, to successfully submit the settings. Clicking on OK will sing out the active user session.

The PowerShell script

Citrix – Backup Netscaler MPX/VPX/SDX appliance with powershell

Summary

You or your company operate a Citrix Netscaler MPX/VPX/SDX appliance and need a backup?

Here is a method with a PowerShell script to backup your Citrix Netscaler appliance regardless of the version and appliance platforms.

Description and configurations steps

The script running in my scenario on central scripting server in the data center, triggered by a scheduled task. Following steps are necessary to run the PowerShell script automatically over a scheduled task.

  1. Create a command policy and backup user on your Citrix Netscaler appliance with restricted permissions, to run the PowerShell script from outside the Citrix Netscaler appliance.
  2. Open firewall ports between the server that run the PowerShell script and your Citrix Netscaler appliance.
  3. Save the files to your script server (show prerequisites)
  4. Run the PowerShell script through an scheduled task

Script variables

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

  • Parameters from scheduled task command line variables (script line 13 – 19) $appliancename and $backupuser (In my scenario, the scheduled task can be run with variables in the command lines section, the appliance name and backup user name are defined by the variables.)
  • The location of the script and temporary files (script line 28) $backuproot
  • The location where the backup files will be saved (script line 29) $backupfolder
  • The name of the compressed backup file (script line 30) $backupname
  • $decodedDATA are the password for the backup user on the Citrix Netscaler appliance (in my environment I have saved the password in a Base 64 file)

Prerequisites

The following applications should be available on the windows server that run the PowerShell script.

  • 7-Zip or something similar
  • PSCP (pscp.exe) from Putty source
  • PLink (plink.exe) from Putty source

1 Create a command policy and backup user on your Citrix Netscaler appliance

Command Policy Regex:
(^create\s+system\s+backup.*$)|(^rm\s+system\s+backup.*$)|(^show\s+ha\s+node.*$)|(^scp.*)

Create a backup user on your Citrix Netscaler appliance, with following settings.
 

2 Open firewall ports between the server that run the PowerShell script and your Citrix Netscaler appliance

Open on your firewall between the script server and the Citrix Netscaler the TCP Port 22 (SSH).

3 Save the files to your script server

Backup root folder “C:\Program Files\Citrix\NetScalerBackup”. Save the powershell script in this folder, or to the path you like.

Backup program path “C:\Program Files\Citrix\NetScalerBackup\_DATA” Save the PLINK.exe ans PSCP.exe from the Putty source in this folder.

4 Run the PowerShell script through a scheduled task

To run the PowerShell script with a scheduled task, create an action with following command line parameters:

powershell.exe -file “C:\Program files\Citrix\NetScalerBackup\NSBackup_FullBackup.ps1” -appliancename nsvpx01.wdho.nt -backupuser ns_backup

The PowerShell script copy the compressed Full Backup to the destination folder.

The PowerShell script

The script create a full backup of your Citrix Netscaler appliance, compress the backup data and copy the compressed file to a CIFS share, or file location you specified in the PowerShell script.After the backup was created and copied, the PowerShell script delete the backup on the Citrix Netscaler appliance. When you have an HA pair of Citrix Netscaler, the PowerShell script also delete the backup on the HA secondary member (The HA sync service in the primary node, copy the backup to the secondary node).

 

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.