I got a question (you know who you are) if I had a WMF 4 PowerShell wrapper and while I didn’t at the time I thought I would create one as you still need WMF4 to be installed before WMF 5 can be installed.
Create a simple folder structure looking like this
In the source folder place the files for WMF4 that can be downloaded from Microsoft Download here https://www.microsoft.com/en-us/download/details.aspx?id=40855
Download the script here http://bit.ly/1TAck2I
Import as an application into MDT and either dynamically assign the application or add it into your Task Sequence the same way I do in my Windows Management Framework 5 here https://syscenramblings.wordpress.com/2016/02/26/wmf-5-in-the-reference-image/