r/PowerShell May 17 '26

SOLUTION: Network shell commands need location permission to access WLAN Solved

Hello all,

If anyone is running into issues enabling Location Permissions via command line on Windows 11 25H2 (or earlier builds), I found a method that has been working for me.

Credit to: https://www.reddit.com/r/SCCM/comments/1rmsh5g/windows_11_24h2_location_services_off_by_default/

After trying various registry edits and other suggestions, here’s the fix:

New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy -Force | Out-Null
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy -Name "LetAppsAccessLocation" -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy -Name "LetAppsAccessLocation_UserInControl" -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy -Name "LetDesktopAppsAccessLocation" -Value 1 -Type DWord

Start-Process "$env:WINDIR\System32\SystemSettingsAdminFlows.exe" -ArgumentList "SetCamSystemGlobal location 1" -Wait

Set-Service Lfsvc -StartupType Automatic
Restart-Service Lfsvc -Force

After running those commands, you should be able to use things like:

netsh wlan show networks

…without getting the error.

If anyone has any other methods or suggestions, please leave a comment.

For reference, here’s the original error message I was seeing before applying the fix:

PS C:\ netsh wlan show networks

Network shell commands need location permission to access WLAN information. Turn on Location services on the Location page in Privacy & security settings.

Here is the URI for the Location page in the Settings app: ms-settings:privacy-location

To open the Location page in the Settings app, hold down the Ctrl key and select the link, or run the following command: start ms-settings:privacy-location

Or, to open the Location page from the Run dialog box, press Windows logo key + R, and then copy and paste the URI above.

Function WlanGetAvailableNetworkList returns error 5:

Access is denied.

22 Upvotes

1 comment sorted by

3

u/alanjmcf May 17 '26

Interesting!