First, you need to enable script execution in your PowerShell: https://superuser.com/a/106363
Second, make a folder where you will store this script. For example, it could be ~/scripts, where ~ is a system substitute for your home folder (C:\Users\<your login>). Create the folder and download the FixAutoAddedKBLayout.ps1 script in it. Running this script (right-click and run) should fix the keyboard layouts.
This won't fix the layouts forever, the extra layout will come back at some point. So what I did was setup a schedule to run this script every once in a while. This is done using the RegisterCronJob.ps1 script. Put it in the same folder and run it. That should register a schedule to run FixAutoAddedKBLayout.ps1 every time the computer is idle for 3 minutes. You can edit the condition to start the script using information on that page.

This solution you mention doesn't reliably work.
As for the error you were getting, you need to enable execution of scripts in your Powershell: https://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts