Windows Mobile Hotspot
Tags: powershell, mobilehotspot, hotpsot
Published: 2021-01-26 17:06:19

If you use Windows Mobile Hotspot and want to make some changes that aren't in the interface, then you might find this post interesting.


All of these answers were discovered by me with a combination of Sysinternals procmon and C# code I have written and exist nowhere else on the net other than in this post and the superuser forums that I answered these questions.

I hope this information will be of use to someone.


Random Quizling:
I try to use Windows Mobile hotspot to connect technical device with my notebook. It's working, but only if the notebook has connection to Internet. I need to use this configuration without Internet too. Is it possible somehow to start Windows Mobile hotspot without Internet or having created Microsoft Virtual Loopback adapter?


ME:
Yes, you can...

First create your loopback adapter. You can create a loopback adapter by opening device manager, click on your computer name at the top of the list, then go to action menu/add legacy hardware. From there click next, then Install the hardware that I manually select from a list, then select Network Adapters, then next, then select Microsoft on the left and Microsoft KM-TEST Loopback Adapter on the right, then next and next again.

Go to Control Panel/Network and Internet/Network and Sharing Center/Change adapter settings. Right click on network adapter you just created and rename it to Loopback.

Then you can run this PowerShell script to start the hotspot bound to the loopback adapter.

$profile = [Windows.Networking.Connectivity.NetworkInformation,Windows.Networking.Connectivity,ContentType=WindowsRuntime]::GetConnectionProfiles()  | where {$_.profilename -eq "loopback"}

$tether = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager,Windows.Networking.NetworkOperators,ContentType=WindowsRuntime]::CreateFromConnectionProfile($profile)

$tether.StartTetheringAsync()

You can make other changes by going to Mobile Hotspot in Settings, e.g. turn off power saving so the hotspot doesn't automatically disable itself if no client is connected.

Your hotspot(host) will have the IP address 192.168.137.1 and you will be able to access it by computer name if you make the firewall changes below.

All firewall rules still apply to this network, so access to your computer will be in the PUBLIC network. I have set the loopback adapter to private, and it works, but for some reason it always eventually sets itself back to public, presumably because the network can't be identified.

To access shares on the host: Go to Control Panel/Network and Internet/Network and Sharing Center/select change advanced sharing settings on the left, then click Guest or Public and Turn on network discovery and turn on file and printer sharing.



Another random Quizling:
I am trying to connect my tablet directly to my laptop for better performance in in-home streaming (Steam Link iOS app). However, when both the laptops's connection to the internet and its hotspot use the builtin Wifi hardware, I am experiencing significant stuttering. In terms of a ping from tablet to laptop I am seeing lost packages and latency spikes.

After connecting a USB Wifi adapter I have noticed, that Windows 10 will still use the builtin wifi hardware for creating the hotspot.

Is it possible to tell Windows 10 to use the builtin Wifi adapter for connecting to the internet, and the USB-adapter for providing the hotspot?

Workaround (limited/inconvenient)
Since posting the question I found, that I can work around the problem by connecting the USB Wifi-Adapter to the home-wifi. Enabling mobile hotspot then (presumably) uses the built-in wifi adapter, allowing the following topology:

             <poorly drawn text image omitted>

It isn't a full solution however, as I can attach a more powerful antenna to the USB-Adapter, but not to the built-in adapter, for streaming across room boundaries. Additionally, when pluggin in the USB adapter this way instead of only enabling the hotspot, more steps are needed:

Disable the connection of the builtin-adapter to the Home wifi
Enable connection of the USB Adapter to the Home wifi
Enable mobile hotspot.


Me:
Yes, you can select which interface the mobile hotspot is using if you are willing to edit the registry.

The key you need to modify is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc\Settings\PreferredPublicInterface.

Make sure the hotspot is off before you make a change.

The binary data in this key is the ID of the adapter you want to use. You can get the adapter id with:

wmic nicconfig get description,settingid

To make it easier you should export the registry key (and make a copy) and change the current PreferredPublicInterface with your new one and then import it back into the registry.

Each section between the dashes of the id has its bytes reversed in the binary key, e.g. if the Id of the interface you want to select for Windows to use as the adapter for the Mobile Hotspot is:

01020304-0506-0708-0910-111213141516

then the data you would put in the key would be:

04 03 02 01 06 05 08 07 10 09 16 15 14 13 12 11

or in the registry file:

"PreferredPublicInterface"=hex:04,03,02,01,06,05,08,07,10,09,1,15,14,13,12,11

Tested on my computer, works without issue.



Yet another random Quizling:
How do I increase the maximum number of connected devices from eight to twenty?


Me:
If you add a Dword value named WifiMaxPeers to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc\Settings it will change what the upper limit in Mobile Hotspot.