r/PowerShell • • Nov 28 '22

PSMSI: Create MSIs with PowerShell

https://github.com/ironmansoftware/psmsi
156 Upvotes

11 comments sorted by

17

u/purplemonkeymad Nov 28 '22

Nice, easier than messing around with XML that you normally have to do a bit of with WiX toolset.

Can -Content contain any PS code? Ie so you can do:

-content { Get-Childitem $path | New-InstallerFile }

6

u/har0ldau Nov 28 '22

Looking at the code, it does seem possible.

1

u/skatterbrainz Nov 29 '22

If you include -File (PS 7.x) or on PS 5.1 use Where {$_.Attributes -ne 'Directory'} it works fine. But on PS 5.1, get -childitem still returns sub-directories, and that will cause an error with New-InstallerFile

2

u/Forsaken_Class3432 Dec 01 '22

-File works in PS5.1 & PS7+

1

u/skatterbrainz Dec 04 '22

You are correct. I was working with a bunch of VM's that day and some were on PS 2.0 (no kidding). Thanks for the correction!

7

u/AlexHimself Nov 29 '22

Can somebody give a few simple use cases for this?

Is the purpose to package PS code into an executable? Similar to PS2EXE?

Or is this more of an improvement as a utility for developers to package other code, like MSBuild?

6

u/nascentt Nov 28 '22

I saw this recommended in the earlier thread too

3

u/vouksh Nov 28 '22

I'll definitely be checking this out. I hate relying on InnoScript installer. It's hard to implement as part of a CI/CD pipeline, but I can see integrating this.

1

u/RevolutionaryRing487 Nov 28 '22

This looks really promising! Thank you for sharing

1

u/jsiii2010 Nov 28 '22

Interesting.

1

u/skatterbrainz Nov 29 '22

I've done some limited testing and it looks like it could be really helpful for LOB apps especially. I'm still learning some of the features.