And... Windows doesn't want you trying to change the hostname and if it did, it would have you do so using some sort of "net whatever" command rather than a POSIX'y sort of way. I suppose it would have been good to know this from the initial post.
So now, it's necessary to tell OctoPrint not to try to change the hostname.
Behind-the-scenes in OctoPrint, there's a name-broadcasting service which reasonably is called Bonjour (Apple-based). The code indicates "Zeroconf/Bonjour/Avahi" as the discovery services.
If this is the cause, then in the
~/.octoprint/config.yaml file, there would be a name/hostname listed in the:
...section. In theory, this might be the part which is trying to set the broadcastable name of the printer.
And then, perhaps @foosel knows what this is. But she's going to want you to try running in Safe Mode first to see if the problem goes away.