I've just spent two hours figuring out how to repair Location Services in Windows 10, and I simply can't resist sharing my battle scars. Although it's somewhat off-topic for this blog, as we primarily focus on helpdesk software and customer support, I believe someone might find this information useful. After all, a significant portion of helpdesk, tech support, and sysadmin tasks revolve around addressing Windows glitches, and I've yet to come across comprehensive resources on this particular issue.
It was the Windows' scheduled "night light" setting that was driving me nuts for months, providing incorrect and seemingly random "sunset to sunrise" times. Despite countless hours lost Googling for workarouds (such as disabling/re-enabling "location services," setting a "default location," and editing night-light registry keys), nothing seemed to resolve the issue.
Even though I had "location services" on, the "Maps" app was still unable to determine my coordinates at all.
That's when I realized that the "Geolocation service" AKA "lfsvc", was not just disabled — it was entirely absent from my PC.
The file lfsvc.dll
was present, but no service running. To make matters more frustrating, there was a notable absence of information on the Internet about how to reinstall the "Geolocation service" back. Zero. In fact, that's part of the reason I decided to write this post. Anyways, after some extensive digging, here's what I found:
1. Open a command prompt with administrator privileges and use the following command to recreate the "Geolocation service":
sc create lfsvc binpath="%SystemRoot%\system32\svchost.exe -k netsvcs" DisplayName= "@%SystemRoot%\System32\lfsvc.dll,-1" start= demand
However, this step alone is not sufficient. The service will fail to start, and it will complain about a "file not found" error without specifying which file is missing. The trick here is that you need to recreate the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lfsvc
registry key with specific default values. Unfortunately, the sc create
command does not handle this part for you.
2. If you don't have access to a friend's Windows machine to borrow this reg-key from, as was my case, you can launch a Windows VM on a service like AWS and copy the required registry key from there. That's exactly what I did, and here's the REG file for your convenience.
In summary:
If your Windows location service isn't working correctly or your "night light" settings are providing incorrect sunset/sunrise times, ensure that "Setting - Privacy - Location" is enabled. And that the "Geolocation service" is both enabled and set to "manual" startup in the services list. Verify by running the "Maps" Windows app and click the "my location" button in it.
If you find that the "Geolocation service" is not present in the services list, you can reinstall it using the command mentioned above and import the provided REG file into your registry. This should help resolve the issue.