And if you use your Phone to read the QR Code you will be able to connect to the WiFi directly.

This is basicaly all the code that is needed.
My code is located at my PowerShell Github repository.
The script is called Create-WiFiPoster.ps1 and contains my PowerShell function
Create-WiFiInfoDocument.