Archived
33 lines
1.7 KiB
PowerShell
33 lines
1.7 KiB
PowerShell
# 1. Kill the Settings app completely so it re-queries state on open
|
|
Stop-Process -Name "SystemSettings" -Force -ErrorAction SilentlyContinue
|
|
|
|
# 2. Fix the Geolocation service dependencies and permissions
|
|
sc.exe config RpcSs start= auto
|
|
sc.exe start RpcSs
|
|
|
|
sc.exe config lfsvc start= auto
|
|
sc.exe start lfsvc
|
|
|
|
# 3. Force the Location Broker Configuration and Consent Flags
|
|
$regTweaks = @(
|
|
# Master switch registry path for Windows 11
|
|
@{ Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location"; Name = "Value"; Value = "Allow"; Type = "String" },
|
|
@{ Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location"; Name = "Value"; Value = "Allow"; Type = "String" },
|
|
# Sensor system permissions
|
|
@{ Path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"; Name = "SensorPermissionState"; Value = 1; Type = "DWord" },
|
|
# Geolocation internal provider state
|
|
@{ Path = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"; Name = "Status"; Value = 1; Type = "DWord" },
|
|
# Clear MDM/Policy blocks if present
|
|
@{ Path = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\System\AllowLocation"; Name = "value"; Value = 1; Type = "DWord" }
|
|
)
|
|
|
|
foreach ($tweak in $regTweaks) {
|
|
if (-not (Test-Path $tweak.Path)) {
|
|
New-Item -Path $tweak.Path -Force | Out-Null
|
|
}
|
|
Set-ItemProperty -Path $tweak.Path -Name $tweak.Name -Value $tweak.Value -Type $tweak.Type -Force
|
|
}
|
|
|
|
# 4. Restart Explorer and launch Settings directly back to Location
|
|
Stop-Process -Name "explorer" -Force
|
|
Start-Process "ms-settings:privacy-location" |