PowerShell: Fixing “Windows could not connect to the Group Policy Client service”

My wife got this error the other day on her Windows 10 machine when trying to login.  After a bit of digging, it seems it’s not unheard of but there’s no clear answer about why it happens (It’s a corrupted / missing set of registry entries.  The cause could be a bad shut-down, crash, interrupted update or pre-cursor to Martian attack.  Who knows.)

I found a good site that provides a solution. To fix the issue you need to create a registry sub-key and value (confusingly, both of the same name) and a pair of values under the sub-key you just created. That cures the problem but there’s no more information about to how to prevent it happening again.

In lieu of a proper preventative solution I wrote a script to perform the changes (with a bit of safety code too) so if it re-occurs I’m good to go.

Script and walk-through after the line. Continue reading “PowerShell: Fixing “Windows could not connect to the Group Policy Client service””