# 1. Terminate Settings app to allow clean reload Stop-Process -Name "SystemSettings" -Force -ErrorAction SilentlyContinue # 2. Configure and start lfsvc service sc.exe config lfsvc start= auto sc.exe start lfsvc # 3. Enable Master Machine Location Access (HKLM) reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Allow" /f # 4. Enable User Profile Location Access (HKCU) reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Allow" /f # 5. Enable internal service configuration flag reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" /v "Status" /t REG_DWORD /d 1 /f # 6. Enable Windows Sensor platform permissions reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /v "SensorPermissionState" /t REG_DWORD /d 1 /f # 7. Remove Group Policy overrides if present reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocation" /f 2>$null reg.exe delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocation" /f 2>$null reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocationScripting" /f 2>$null reg.exe delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocationScripting" /f 2>$null # 8. Restart service to apply immediately Restart-Service -Name "lfsvc" -Force