Solved netsh wlan query access is denied


luckfade

Member
Local time
3:49 AM
Posts
8
OS
Windows 11
I am literally struggling mentally to how to fix this for days.

This is what I want to fix:
C:\Windows\System32>netsh wlan show interfaces

There is 1 interface on the system:
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 WlanQueryInterface returns error 5:
Access is denied.


I have literally tried EVERYTHING I could. I am a privacy focused person so I keep my location always turned off but Microsoft suddenly decided that now the network shell would require location permissions to work. I have turned on location now from settings and it still doesn't work and gives me access is denied.

Other things I have tried:
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /v SensorPermissionState /t REG_DWORD /d 1 /f


reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v Value /d "Allow" /f


reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v Value /d "Allow" /f


reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v DisableLocation /t REG_DWORD /d 0 /f


I am still getting the same error, please help.
 
Windows Build/Version
25H2 (OS Build 26200.8037)

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
I am still getting the same error, please help.
I'd put this in a cmd file:

Code:
cmd /s /c "reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy /v LetAppsAccessLocation /t REG_DWORD /d 0 /f"

Screenshot 2026-03-14 182051.webp


Without it I get the error you described:

1.webp
 

My Computers My Computers

  • At a glance

    All Branches but StableAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Stable
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
1773510044257.webp


what should i do next?

Edit: I restarted the wlan service and it worked.
Thank you so much.
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
  • Like
Reactions: OAT
Do you know a way where I could disable location but still be able to execute the network shell?

I absolutely do not want to share my location data to any app unless absolutely necessary.
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Do you know a way where I could disable location but still be able to execute the network shell?

I absolutely do not want to share my location data to any app unless absolutely necessary.
If you use the same batch you could change the value REG_DWORD /d 2
Then you would have an on/off switch by creating 2 batch files.
Otherwise, that is pretty much the only way to go that I know of.
BTW, when I use that method, I never have to restart the service,
but that could of course, be included in the batch file as well using sc.
 

My Computers My Computers

  • At a glance

    All Branches but StableAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Stable
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
The thing is I am using a program called Netlimiter which is calling the netsh wlan query.
If I had to use particular commands occasionally, I could make it as a script and use it as an on/off switch just as you described — but what about Netlimiter (please don't recommend alternatives, this is what I want to use).


This change was absolutely unnecessary by Microsoft, why did they do this? Do they need more telemetry data? Why do you think did they needed to do this?
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
They're trying to protect the BSSID, so only apps which have permission for Location Services can read BSSID. Which includes netsh, otherwise it would be an easy backdoor to bypass app permissions.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
They're trying to protect the BSSID, so only apps which have permission for Location Services can read BSSID. Which includes netsh, otherwise it would be an easy backdoor to bypass app permissions.
Thank you for explaining that.
That means I just have to provide the network shell with the location permission and not the "actual" location data. right? Would it still work?
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11

My Computers My Computers

  • At a glance

    All Branches but StableAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Stable
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
Oh great, do you run the script before using the software or have you made it to monitor calls in the background from any software and then have the script executed on command? — I guess we can do that through applocker.
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Oh great, do you run the script before using the software or have you made it to monitor calls in the background from any software and then have the script executed on command? — I guess we can do that through applocker.
Keeping it simple and fast. Batch ON > Software > Batch OFF.
Of course the batch file can also include a line to start the software you want to run.
A delay within the batch file such as
Code:
Ping -n 10 127.0.0.1 >Nul
can also insure enough time is provided for the interface to be accessed.
-n 10 represents the value of about 10 seconds.
 

My Computers My Computers

  • At a glance

    All Branches but StableAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Stable
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
Windows has a command to wait for a number of seconds, timeout /t 10. Handy for situations where the delay between pings is not one second.
 

My Computer My Computer

At a glance

Win11 Ent. 25H2
OS
Win11 Ent. 25H2
I don't have Wi-Fi on my desktop, but I'm wondering if "Vivetool /disable /id:41162753" restores the old behavior.

According to Albacore's feature ID dictionary, that's WlanLocationPermission.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
I don't have Wi-Fi on my desktop, but I'm wondering if "Vivetool /disable /id:41162753" restores the old behavior.

According to Albacore's feature ID dictionary, that's WlanLocationPermission.
Does not seem to work anymore.:(
The old behavior is not restored.
 

My Computers My Computers

  • At a glance

    All Branches but StableAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Stable
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
I have just restarted my computer and I am facing the error again; I have manually checked all the registry values and they are unchanged — what is causing this? I have also tried restarting the wlan service just like last time but I still get the same error.
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Do you know a way where I could disable location but still be able to execute the network shell?
I've obtained the interface name without enabling location services in Windows 11 Version 26H2. My solution also works in Windows 10 Version 22H2.
I start with a PS cmd run within a batch script then I tidy things up to strip out all but the WiFi adapter name.
prompt $g

for /F "tokens=*" %%X IN ('powershell Get-NetAdapter -Name "w*" ') do Call :Interfaces %%X %%Y
GoTo EndGetWiFiAdapterName

:Interfaces
set ThisAdapterName=%1 %2
If "%ThisAdapterName:~0,4%"=="Name" GoTo :EOF
If "%ThisAdapterName:~0,4%"=="----" GoTo :EOF
GoTo :EOF

:EndGetWiFiAdapterName
echo After processing completed ThisAdapterName is %ThisAdapterName%
Pause to check outcome during testing

Notes
- Like you, I used to use netsh wlan show interfaces but my update to 26H2 put the kibosh on that because I have location disabled [it might have gone wrong earlier, I have not had to use netsh for a while].
- I need to get the WiFi adapter name so I can use it in a script that goes on to use other netsh cmds to set WiFi priorities & auto-switching. I use the same script on all my Windows 10 & Windows 11 computers and the section I have posted above works on them all.
- On my computers, the WiFi adapter names always start as WiFi but sometimes Windows can change that to, for example, WiFi 2 but I do not want to go through checking & correcting this on individual computers.
- I learnt about the PS cmd needed at Get-NetAdapter - MSLearn
- I often have one of more Ethernet adapters on my computers but only a single WiFi adapter at a time.
- My script avoids leaving any leading or trailing spaces in the adapter name. You can see that, if you wish, by replacing that last echo cmd line with
echo After processing completed ThisAdapterName is FF%ThisAdapterName%FF
- I had started off trying to get a more precise PS response by selecting just the Name property but I could not get that expression working in the batch cmd script [which I'm stuck with because I have not yet learnt the PS cmds for setting WiFi priorities & auto-switching.
The full expression in my batch script during this experiment was powershell Get-NetAdapter -Name "w*" ^| select-object -property "Name"
- I've had a quick play with using my original Netsh commands for setting WiFi priorities & auto-switching and they seem to play ball still despite the disabled location settings. So I expect to be able to complete my full script but my stomach is complaining about its lack of dinner so I'm stopping for the night.


I hope this is useful for you,
Denis
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Home x64 Version 26H2 Build 26300....
OS
Windows 11 Home x64 Version 26H2 Build 26300.9457
I am using a program called Netlimiter which is calling the netsh wlan query
I had not previously spotted the Netlimiter statement in post #6.
Since Netlimiter is important to you I suggest you try their latest version [released a week or so ago] and, if still necessary, ask their support team how to cope with their problem without enabling location.


Best of luck,
Denis
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Home x64 Version 26H2 Build 26300....
OS
Windows 11 Home x64 Version 26H2 Build 26300.9457

Latest Support Threads

Back
Top Bottom