r/PowerShell • • Nov 28 '22

PSMSI: Create MSIs with PowerShell

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

11 comments sorted by

View all comments

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!