Citrix App Layering Preparation Script

This script can be used to prepare layers right before they are finalised.

To install and configure App Layering 4.x see: http://www.jgspiers.com/installing-configuring-unidesk-4/

To create and update an OS Layer see: http://www.jgspiers.com/create-update-os-layer-unidesk-4/

To create and update an Application Layer and create Elastic Layers see: http://www.jgspiers.com/application-layers-elastic-layering-unidesk-4/

Script author: George Spiers – @JGSpiers

With thanks to Trentent Tye for allowing me to include his Ghost Device removal script.

Tested working on OS version: Windows Server 2016, Windows Server 2012 R2, Windows Server 2008 R2, Windows 10, Windows 7.

Description: This scripts runs a number of tasks to clean out temporary folders, clear out Event Log entries, remove ghost devices from Device Manager, and run NGEN native image regenerations before shutting down the image in preparation for layer finalisation. If running this script on Windows 8.1+ or Windows Server 2012 R2+ there is an extra firewall check that looks to see if any of the firewall profiles are disabled and if so, asks if you want to enable them. When patching within an OS Layer version my patching software requires a number of ports to be open and it is easier just to temporarily disable the firewall until patching is done. The problem was remembering to enable the firewall again!

Note: You should run this script each time you create an OS Layer version, Application Layer/version and Platform Layer/version.

Instructions: You must run this script as an administrator. You must also set the PowerShell Execution Policy to atleast “RemoteSigned” or “Unrestricted”.

Download (click below):

App Layering Preparation Script (1047 downloads)


19 Comments

  • ciprian

    August 21, 2017

    download link it’s not working ..yet

    Reply
  • ciprian

    August 21, 2017

    working now.

    Reply
  • Rotem Sfarad

    August 23, 2017

    sound very helpful thanks buddy ;).

    Reply
  • Nick Panaccio

    August 23, 2017

    Out of curiosity, is there any reason you’re asking for the full path of the script on line 52 instead of using something like the following?

    $ScriptPath = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)

    Either way, thank you for this.

    Reply
    • George Spiers

      August 23, 2017

      No reason at all! Your suggestion is one less input so I’ll stick it in the script. Thanks

      Reply
  • Pingback: App Layering – App Layers, Image Templates, and Publishing – Carl Stalhood

  • Pingback: Detailed Change Log – Carl Stalhood

  • Ci

    September 14, 2017

    i ran the script, but sometimes i got error on ngen still ran in background…i have to choose shutdown fro finalized exe provide by unidesk. But i did notice that if i just unidesk exe , my PVS will become non genius

    Reply
  • Pingback: App Layering – OS Layer and Platform Layer – Carl Stalhood

  • R

    October 16, 2017

    Sorry, does anybody else have a problem with the zip not opening ? Says Zip file is invalid

    Reply
    • George Spiers

      October 16, 2017

      What program are you using to unzip?

      Reply
      • R

        October 18, 2017

        windows 7 also tried 7zip …. both said invalid file …..

        Reply
        • George Spiers

          October 18, 2017

          No issue here. Windows 10 using 7zip.

          Reply
          • R

            October 19, 2017

            my ver of 7zip was too old , updated 7zip and is working now … Thanks for checking

          • George Spiers

            October 19, 2017

            Thanks for letting me know the issue!

  • R

    October 19, 2017

    Have you had any issues with the script removing ALL network adapters?
    That happened to me when i ran it finalizing/optimizing a platform layer (xenserver,pvs, xendesktop , vda 7.9 )

    Reply
    • Nick Panaccio

      October 19, 2017

      I haven’t noticed it removing all adapters, but I did find that it was removing some ghost devices that I actually needed. I wound up creating a “Lite” version of the script that displayed the ghost devices, but did not actually remove them.

      Reply
    • George Spiers

      October 19, 2017

      It should not remove any device other than “Ghost Devices” as Nick mentions. You could disable that part of the script to prevent such behaviour.

      Reply
      • RP

        October 25, 2017

        After looking into this again , the network adapter is showing fine when i finalize the platform layer , i can build an image ,publish , networking is fine .

        When I add a version to the platform layer , that’s when I lose the network adapter …., network connection folder is emty , device manager still shows the adapter as working ?

        Reply

Leave a Reply