For many years I have always shared Internet to my devices like phone and tablet with my PC's WiFi antenna through the Microsoft Wi-Fi Direct Virtual Adapter, I only use it for that, since I have a cable connection, and I start the wifi with the command NETSH WLAN start hostednetwork previously having done the settings of NETSH WLAN set hostednetwork mode=allow ssid="Wifi" key="password".

For my devices to connect it is necessary that the Virtual Adapter that is created with that command has access to the Internet, for this I have to share the Internet from my Ethernet adapter to the Virtual Wifi adapter.

For some time now (a couple of months) I've been experiencing problems when sharing the Internet through that medium. The problem is that when I start the WiFi my devices do not connect, they say "Getting IP address" and never connect.

I have found the solution and I have to do the following:

  1. Disable the Virtual Adapter with the command netsh wlan stop hostednetwork.
  2. Remove the connection sharing from the Ethernet Adapter.
  3. Activate the Virtual Adapter with the command netsh wlan start hostednetwork.
  4. Adding connection sharing from the Ethernet Adapter to the Virtual Adapter again.

By doing these steps my devices can now be connected to the Wifi, but sometimes it doesn't work if I do these steps too quickly. I have noticed that if I do step 3 and 4 too quickly it does not work and I have to repeat the process but doing these last two steps more slowly, until the Virtual Adapter gets an IP address from Internet Protocol version 4

Also this problem does not occur 100% of the time. Sometimes when I run the command to start the Wifi everything happens fine and my devices connect well but this only works after my PC has been on for at least 5 minutes (I haven't counted it). If I run the command as soon as my PC has turned on then it doesn't work anymore.

As I mentioned before this problem didn't occur before because I had configured a .bat file that ran as soon as the PC was turned on with the NETSH WLAN start hostednetwork command and everything worked fine.

Now, I would like to go back to before when everything was fine so that when my PC starts up the WiFi too and I don't have to do all this protocol all the time, but with a simple command everything is solved.

Could someone give me a hand with this?