How do I create a wireless ad hoc network in Windows 10?

In Windows 10, it is still possible to create a wireless ad hoc network, but not through the GUI. You have to use an elevated CMD or PowerShell.

Before creating it, make sure your WiFi adapter supports the creation of a wireless ad hoc network. Execute the following command:

netsh wlan show drivers

Assert that the line Hosted network supported: ends with Yes. Otherwise, you have to update your drivers or use different drivers (like using a more specific driver for your adapter model instead of a generic driver).

Creation

  1. Configure your wireless ad hoc network:

    netsh wlan set hostednetwork mode=allow ssid=MySSID key=MyPassword keyUsage=temporary
    

    If you plan to reuse this configuration, omit the keyUsage parameter (or set it to persistent). Setting it to temporary makes sure that the password will not be stored permanently.

  2. Enable your wireless ad hoc network:

    netsh wlan start hostednetwork
    

You are then ready to go. You can issue netsh wlan show hostednetwork to monitor its status or ipconfig /all to retrieve the IP address of your laptop for the wireless ad hoc network.

Deletion

  1. Disable your wireless ad hoc network:

     netsh wlan stop hostednetwork
    
  2. Delete your wireless ad hoc network configuration. Unfortunately, you cannot do that directly. Your SSID will remain in the registry, for example. A workaround is to reset the configuration to its defaults:

    1. Stop the WLAN AutoConfig service:

       Stop-Service wlansvc
      
    2. Delete the wireless ad hoc network configuration from the registry:

       Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Services\WlanSvc\Parameters\HostedNetworkSettings"
      
    3. Start the WLAN AutoConfig service (it will automatically restore the defaults in the registry):

       Start-Service wlansvc