Jan 9, 2024 11:04 AM
(This post was last modified: Mar 16, 2026 08:20 PM by Hackers.)
![[Image: header4.gif]](https://i.ibb.co/C33BJJJg/header4.gif)
If you want to turn off wireless connections or other networking options, it's easy to do that with netsh. This is a Windows only tutorial, but Linux or Mac users could still use some of the examples at end of the guide for running commands via languages - but you would need to adjust it to not use netsh and instead use your native OS APIs and features instead.
First we will use a command that shows us the network profiles we've connected to in the past:
List All Network Profiles
Code
netsh wlan show profilesExample response:
Code
All User Profile : office-internal
All User Profile : Mandarin Oriental 2
All User Profile : Omni Guest
All User Profile : Home A107CDisconnect From Current Network
Code
netsh wlan disconnectDelete Specific Network Profile
Code
netsh wlan delete profile name="Home A107C"Disable Computer Wireless Networking / Wifi
Code
netsh interface set interface \"Wi-Fi\" admin=disableDisable Computer Ethernet / Wired Connections
Code
netsh interface set interface "Ethernet" admin=disabledYou may be required to use escalated, administrator permissions on the terminal when using it. Similarly, if you run the commands from another program then that program would need same permission level.
Here are some ways you can execute these commands via code:
C++
Code
#include <cstdlib>
system("netsh interface set interface \"Wi-Fi\" admin=disable");PHP
PHP Code
<?php
exec('netsh interface set interface "Wi-Fi" admin=disable');
?>Python
Code
import subprocess
subprocess.run('netsh interface set interface "Wi-Fi" admin=disable', shell=True)The three above are tested by me and have been used in past to run other commands. The code below is not tested, but I asked GPT to create some examples based on this for C, Java, and Go as I know several HF users are coding with those:
Spoiler (Click to View)
I hope that this is helpful to you in some way for managing your network profiles and possibly automating this in your scripts as well. Ask questions or share knowledge below :)



