Automated MSIX Repackaging with PSF

I recently posted a twit with the following caption:

Achievement unlocked.  Re-package 70 apps with PSF with 
click on one button into #MSIX packages.  MMPT + upcoming 
version of TMEditX with command line option to fix the 
packages.

70 Enterprise apps repackaged into MSIX with the PSF in 2.5 hours with one click. Let’s boil this down so others who might be interested can also make use of this…

As mentioned, I used the Microsoft MSIX Packaging Tool along with my TMEditX tool to accomplish this.  This is part of my year long goal to make it easier to repackage applications into working packages than it currently takes.  This effort mostly involves making it trivial for you to use the Package Support Framework (PSF) in the form that is useable for 90% of the apps that needed it. The PSF is a highly capable but complex tool that needs an “Easy Button”.  Now we have it!

Over time, and for various purposes, I have collected a substantial number of applications with automated silent/passive installation scripts that I use to repackage the applications in ways that enterprise customers regularly repackage them.  I use these scripts with a variety of re-packaging tools, especially those that can be automated.  This includes:

  • The Microsoft App-V AutoSequencer which repackages for App-V
  • Admin Studio, which repackages for MSI, App-V, and MSIX
  • Advanced Installer, which repackages for MSI, App-V, and MSIX

And now I add the Microsoft MSIX packager for MSIX, but with a twist I added new automated capabilities to add the PSF by using a new version of TMEditX.

The basis of this automation was the github project hosted by Microsoft called MSIX-Toolkit (https://github.com/microsoft/MSIX-Toolkit). But, as I am often inclined to do, I have created my own fork with improvements to the scripting tool for repackaging using the MSIX Packaging Tool (https://github.com/TimMangan/MSIX-Toolkit).

So what are these improvements:

  • Handling packages that require dependencies and “plugin” package scenarios.
  • A more robust support for working with AD joined machines hosted on Hyper-V, including an automatic retry for packages that hiccup due to Hyper-V issues that invariably occur.
  • You can package in parallel, using multiple virtual machines on multiple hypervisors.
  • You can sign the packages, or integrate into a new TMEditX command line option to inject the PSF and sign.

So using this new version of the script, I was able to prepare 7 packaging VMs and repackage these 70 applications in parallel over the 7 VMs.  I just loaded up the PowerShell script in an elevated PowerShell window, entered my credentials for accessing the remote VMs and Hypervisor, and sat back as the 70 packages were first packaged by the Microsoft Packaging Tool on the remote VMs, and then opened and updated by TMEditX.  This soon to be released version of TMEditX has a new command line interface that allows for automated package analysis and injection of the Package Support Framework.  I used the command line option to save the packages as updated and signed MSIX packages, but I could have just as easily requested CimFS format output packages.

What I’ve done with TMEditX is to automate the most common form of fixups that might be be needed.  After packaging, the scripting runs TMEditX with the /ApplyAllFixes and /AutoSaveAsMSIX options. 

  • TMEditX will analyze the package to determine if the PSF is needed.
  • It will inject the PSF and configure it.  Automatically handling the PsfLauncher, and adding a generic configuration for FileRedirectionFixup, DynamicLibraryFixup, and RegLegacyFixup.  EnvVarFixup is automatically added if the need is detected in the analysis as well.
  • Whether or not the PSF is added, the tool will also perform other forms of fixups commonly needed due to limitations of the MSIX Packaging Tool, and configured file and registry cleanups.
  • It will sign the package (when configured in TMEditX) and even change out the Publisher field of the AppXManifest file to match the certificate.
  • When configured it also updates the package version field so that you can test both before and after updates.
  • Finally, it saves the package off as requested in either MSIX or CimFS form.

This type of packaging might not be for everyone, but the scripting  can be very useful for folks that need to update packages on a regular basis. 

You could even use this scripting as a back end to something like Aaron Parker’s Stealthpupy Project Evergreen (https://github.com/aaronparker/Evergreen) , which automates the discovery and installer download of an increasingly large number of vendor products.  Or for those not supported by Project Evergreen, also see Dan Gohgh’s Project Nevergreen (https://github.com/DanGough/Nevergreen/projects).   You can use those scripts regularly to check for vendor updates and have then automatically downloaded to your application installer share.  Use those projects as a trigger to kick off this scripting, and you’ll arrive each day to a batch of vendor updates already downloaded and packaged.  Ready for testing!

You too can implement Software as a Service, but now with less manual service on your part.

By Tim Mangan

Tim is a Microsoft MVP, and a Citrix CTP Fellow. He is an expert in App-V and MSIX.