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.
Hi, I tried running the script and my target lang is en-US, but it gives me an "Cannot find an overload for "Remove" and the argument count "1"

I have 2 main languages which is Ukrainian and English UK, so should I change something in the code or something?
Will be really grateful for any help since I am not that good with codes and can't really understand why it's not running the way it should :)