When you create a Gold VM to import as your first OS Layer version, you need to install the OS Machine Tools, to install our startup scripts and get them set to run as startup scripts. Later, you add a version to your OS layer and want to upgrade the scripts to the ones from the latest version. So you correctly download and run the OS Machine Tools self-extractor. It unpacks and overwrites your scripts, but you then notice that our startup script, kmssetup.cmd, is running twice at the same time on a published machine.
You can see this in C:\Windows\Setup\Scripts\kmsdir\kmssetup.log, where you might see a pair like this when editing an app or platform layer:
Tue 09/18/2018- 9:58:28.04-kmssetup.cmd:OSLayerEdit Not Found in Registry
Tue 09/18/2018- 9:58:28.04-kmssetup.cmd:OSLayerEdit Not Found in Registry
Or you might see this in a published image:
Mon 09/17/2018-10:55:17.87-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry
Mon 09/17/2018-10:55:17.87-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry
Mon 09/17/2018-10:55:18.02-kmssetup.cmd:Adding old process complete flag files because this is a fresh install
Mon 09/17/2018-10:55:18.02-kmssetup.cmd:Adding old process complete flag files because this is a fresh install
Mon 09/17/2018-10:55:18.06-kmssetup.cmd:------------Configure Powershell-----------
Mon 09/17/2018-10:55:18.09-kmssetup.cmd:------------Configure Powershell-----------
There is no immediate danger to running kmssetup.cmd twice in parallel, since it contains interlock mechanisms to make sure some important functions don't run twice. But it still makes troubleshooting unnecessarily difficult.
You will need to manually delete the second instance of kmssetup.cmd as a startup script from the registry. Unfortunately, if you look at gpedit.msc, Computer Configuration, Windows Configuration, Scripts, Startup, you will still only see one instance of kmssetup.cmd. But in the registry, there are clearly two copies of it. The right place to fix this is the OS layer, where the original damage was done.