Creating .CAB files with Powershell

During our on-going development of online updateable Powershell help (more on that later) you quickly come to realise that each culture-specific set of help files is stored within its own 1980’s style cabinet (or .cab) file. When packing the .cab files for release, I like to automate (if you hadn’t already guessed!) as it makes things quick, easy and certainly less error prone.

Working with .cab files in Powershell requires use of MAKECAB.EXE which, fortunately, is distributed with each edition of Windows. In the good ol’ days we could use the MakeCab.MakeCab.1 COM object, but this has been deprecated since Windows Vista. I had a quick Google and couldn’t find anything easily reusable (except Ed Wilson’s post here) and thus this blog post.

I set to work, creating a Powershell advanced function that would easily allow me to package each culture-specific help file (or one or more files) into its own cabinet file. It would probably be more prudent to utilise .NET’s StringBuilder class but performance is not (currently) an issue or priority!

You never know I might come back and show you how we use this with Psake in the future… Here are some examples of how you can use it:

Here’s the full advanced function:



  1. John D on June 13, 2016 at 22:17

    This is going to save me so much time and effort, just want to say thanks for putting this out there. Not too many helpful resources for this type of material. Thanks again!

  2. Rajneesh on January 23, 2017 at 20:35

    This cuts my work to 1/10 when I need to create a CAB file. Amazing stuff. Thanks a Ton!!

  3. Nqobizwe Ngubane on March 16, 2018 at 11:32

    Thanks Iain, you life saver you

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.