How to Create a Wi-Fi Network Using the Command Line: A Guide

Creating a Wi-Fi hotspot without using third-party programs is a skill that may be needed by a system administrator or an ordinary user in a situation where the standard Windows interface tools are unavailable or do not work correctly. Command line Provides direct access to network drivers, allowing you to turn a laptop or computer with an adapter into a fully-fledged router in seconds. This method is often the only viable solution when the graphical interface freezes or is hidden by corporate security policies.

The main tool for implementing this task in Windows family operating systems is the utility netshIt allows you to manage network configurations at a low level, bypassing many of the limitations of the graphical shell. You don't need to download questionable software or risk your system's security by installing free Wi-Fi hotspots with intrusive ads. All the necessary tools are already built into the OS.

In this guide, we'll walk you through the setup process in detail, highlighting nuances often overlooked in superficial instructions. You'll learn not only how to get the network up and running, but also how to diagnose problems if the adapter refuses to operate in host mode. It's critical to understand that hosted network mode support is directly dependent on your wireless adapter driver, not just your Windows version. Get ready to dive into the world of text commands.

Checking if the adapter supports host mode

Before attempting to set up the network, you need to ensure that your wireless module is physically and software-capable of operating in access point mode. Not all Wi-Fi adapters support simultaneous operation in both client and host modes. To check, open a command prompt with administrator privileges and enter the command netsh wlan show drivers.

In the list of options that appears, find the line "Hosted network supported." If it says "Yes," you can proceed with the setup. If it says "No," you won't be able to launch the network using software—you'll need to update your drivers or replace your hardware. This issue is often resolved by installing generic drivers from the chip manufacturer, not the laptop manufacturer.

⚠️ Attention: If the driver is updated but support is still not showing, try temporarily disabling your antivirus or firewall, as they may be blocking low-level access to the network interface.

It's also worth paying attention to the radio type. Modern standards 802.11ac And 802.11ax may behave differently when running legacy modes. If you have a new adapter but older devices can't see the network, you may need to force compatibility mode in Device Manager.

📊 What version of Windows do you use to create a hotspot?
Windows 10
Windows 11
Windows 8.1
Windows 7
Other OS

Step-by-step access point setup

The network creation process consists of three steps: configuring the settings, starting the network, and enabling internet access. First, we set the network name (SSID) and password. This is done using a command with the ssid and key parameters. The syntax requires specifying the security type, typically WPA2-Personal, which is the de facto standard for home networks.

netsh wlan set hostednetwork mode=allow ssid="MySuperWiFi" key="ComplexPassword123" keyUsage=persistent

After the command runs successfully, the settings are saved. Now the network needs to be activated. The startup command looks simple, but requires a stable driver. If you see the message "Hosted network started," you're halfway there. However, other devices won't be able to access the internet yet, as we've only just created a local gateway.

Next, you need to open “Network Connections” (command ncpa.cpl). Find your primary internet connection (Ethernet or primary Wi-Fi). Right-click, select "Properties," then the "Sharing" tab. Here, check "Allow other users..." and select the virtual connection you created from the list (usually called "Wireless Network" with a number).

Network management and status monitoring

Once launched, it's important to be able to monitor the status of your access point. The command netsh wlan show hostednetwork Displays detailed information: how many devices are connected, the network status, and how much bandwidth is being used. This is an indispensable diagnostic tool when you need to understand why a client isn't receiving an IP address.

To stop distribution, use the command netsh wlan stop hostednetworkThis is useful if you need to temporarily free up a channel or change security settings without completely re-creating your profile. Keep in mind that when you turn off your laptop or enter sleep mode, the network is disabled by default and will need to be restarted.

Team Description of action Necessary rights
show hostednetwork Displaying status and connected clients Ordinary
start hostednetwork Launching an access point Administrator
stop hostednetwork Stopping Wi-Fi distribution Administrator
delete hostednetwork Completely deleting a network profile Administrator

Monitoring also helps identify "random" neighbors. If you see an unfamiliar device in the connection list, it's best to immediately change the password and restart the network. Security in open spaces like offices or coworking spaces should be a priority.

Automating startup via a bat file

Entering commands manually is tedious. The optimal solution is to create a batch file (.bat) that will launch the network with a single click. Create a text file, enter the necessary commands, and save it with the .bat extension. Be sure to run this file as administrator, otherwise the commands will not work.

@echo off

netsh wlan start hostednetwork

echo Access point started!

pause

For full automation, you can set up a task in Windows Task Scheduler. This will allow the access point to start immediately after the operating system boots, even without user login, provided the appropriate permissions are configured. However, it's important to note that the Wi-Fi adapter must be enabled when the script runs.

⚠️ Attention: When starting automatically, ensure that the Connection Manager (WlanSvc) service is already running, otherwise the script will fail. Add a service status check to the beginning of the script.

Scripting is especially important for IT professionals who frequently deploy temporary networks for equipment testing. A single well-written script can save hours of routine work.

Diagnostics and troubleshooting

The most common error is Code 31 ("The hosted network failed to start"). It often occurs after Windows updates or driver failures. The first thing to do is check the Device Manager. Find your adapter, go to Properties, and on the Driver tab, click Roll Back Driver if the button is enabled. Or try updating the driver manually by downloading it from the manufacturer's website.

Another possible cause could be a service conflict. Make sure the Routing and Remote Access service is running and set to automatic startup. Without it, traffic forwarding between interfaces is impossible. It's also worth checking whether the Microsoft Wi-Fi Direct Virtual Adapter is disabled in Network Connections.

If the network is created, but devices cannot connect or receive the error "Unable to obtain an IP address," the problem lies in the DHCP settings. In most cases, resetting the network stack with the command netsh int ip reset and then reboot. Sometimes assigning a static IP address to the virtual adapter helps.

Security of the created network

Using the command line, you set the encryption parameters. Standard WPA2-Personal with encryption AES is the optimal choice. Avoid using the outdated TKIP, as it reduces speed and is less secure. The password should be complex, as brute-force attack dictionaries are readily available online.

Remember that by creating an access point, you become a gateway for all traffic from connected users. Theoretically, with specialized software, the access point owner could analyze the traffic. Therefore, do not use public access points created by unknown individuals to enter banking information unless the connection is secure. HTTPS.

For increased security, you can hide the SSID (although this offers weak protection) or use MAC filtering, although this is more difficult to implement from the command line. The best protection is to monitor connected devices and change passwords regularly.

Is it possible to distribute Wi-Fi if the main Internet is via a USB modem?

Yes, this is possible. When setting up sharing (under the "Sharing" tab in the connection properties), select your USB modem as the source (usually displayed as an Ethernet connection with your carrier name) and the Microsoft Virtual Adapter as the home network.

Why does the netsh wlan start hostednetwork command return an error?

This most often occurs because the WLAN AutoConfig service is stopped, or the adapter driver doesn't support host mode. Also, check if another access point is already running through third-party programs or Windows 10/11 settings.

How many devices can connect to such a network at the same time?

The theoretical limit for Windows is up to 100 devices, but the actual number depends on the power of your Wi-Fi adapter and processor. For stable operation, it's recommended to limit the number of active clients to 5-7 to avoid speed drops.