commit 231b724706ab77aeb075f9cfe8ee6e0ef496602a Author: CristianD Date: Thu Oct 29 16:38:59 2026 +0000 Add WindowsLocationServicesON diff --git a/WindowsLocationServicesON b/WindowsLocationServicesON new file mode 100644 index 0000000..dff491b --- /dev/null +++ b/WindowsLocationServicesON @@ -0,0 +1,52 @@ +# 1. Stop the service first to release any file locks +Stop-Service -Name "lfsvc" -Force -ErrorAction SilentlyContinue + +# 2. Configure lfsvc registry startup type directly (2 = Automatic) +Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc" -Name "Start" -Value 2 -Type DWord -Force + +# 3. Ensure the service host parameters are properly mapped +New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Force | Out-Null +Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Value 1 -Type DWord -Force + +# 4. Remove all Group Policy & MDM location restrictions +$policyPaths = @( + "HKLM:\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", + "HKCU:\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", + "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", + "HKCU:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" +) + +foreach ($path in $policyPaths) { + if (Test-Path $path) { + Remove-ItemProperty -Path $path -Name "DisableLocation" -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $path -Name "DisableLocationScripting" -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $path -Name "DisableSensors" -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $path -Name "LetAppsAccessLocation" -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $path -Name "LetAppsAccessLocation_UserInControlOfTheseApps" -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $path -Name "LetAppsAccessLocation_ForceAllowTheseApps" -ErrorAction SilentlyContinue + } +} + +# 5. Reset master capability consent keys +$consentPaths = @( + "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location", + "HKCU:\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" +) + +foreach ($path in $consentPaths) { + if (-not (Test-Path $path)) { + New-Item -Path $path -Force | Out-Null + } + Set-ItemProperty -Path $path -Name "Value" -Value "Allow" -Type String -Force +} + +# 6. Enable Windows Sensor platform permissions +$sensorGuid = "{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" +$sensorPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\$sensorGuid" +if (-not (Test-Path $sensorPath)) { + New-Item -Path $sensorPath -Force | Out-Null +} +Set-ItemProperty -Path $sensorPath -Name "SensorPermissionState" -Value 1 -Type DWord -Force + +# 7. Start the service +Start-Service -Name "lfsvc" \ No newline at end of file