On Windows 10, the Mobile Hotspot feature is automatically disabled when rebooting the machine. Users are required to manually open the Mobile Hotspot settings and toggle the slider for "Share my Internet connection with other devices" in order to enable it.
The included PowerShell script can be added to the Windows Task Scheduler to automatically turn on your Windows 10 Mobile Hotspot upon reboot, login, and unlock of the workstation by any user.
- Copy the two script files to a folder on your computer:
hotspot.ps1
andhotspot.bat
- Open the Windows Task Scheduler.
- Right-click on Task Scheduler Library and select Create Task.
- Enter a Name and Description.
- Select Run whether user is logged on or not.
- Checkmark Run with highest privileges.
- Click the Triggers tab.
- Click New.
- For Begin the task select At startup.
- Checkmark Delay task for: 1 minute.
- Checkmark Stop task if it runs longer than: 30 minutes.
- Checkmark Enabled.
- Click the Conditions tab.
- Uncheck the options Stop if the computer switches to battery power and Start the task only if the computer is on AC power.
- Click OK.
When saving the Task Scheduler, enter your username (username, ADUser\username, CORP\username, etc.) and your Windows password.
If the hotspot enable task is not running after your PC wakes from sleep/hibernation, you can add a trigger to execute the task as soon as possible after waking. Create an additional trigger with the following steps.
- Edit the task and click the Triggers tab.
- For Begin the task select On a schedule.
- Check the radio option Daily.
- Enter the earliest Start Time to run. For example, 8:00 AM EST. This computer does not need to be awake during this time, so it is recommended to make this time earlier than you actually need.
- Select Recur every 1 day.
- Click OK.
- Click the Settings tab.
- Checkmark the option Run task as soon as possible after a scheduled start is missed.
See also Windows 10 Mobile Hotspot Keep Alive Script.
If the mobile hotspot is turning itself off at random periods, you can try the following settings:
-
Disable mobile hotspot power saving by opening the Mobile Hotspot settings and disabling When no devices are connected, automatically turn off mobile hotspot.
-
Set the PeerlessTimeoutEnabled and PublicConnectionTimeout value to a longer duration. This can be done by setting the registry value
HKLM\System\ControlSet001\Services\ICSSVC\Settings\PeerlessTimeoutEnabled
to 120 (Hexadecimal) andHKLM\System\ControlSet001\Services\ICSSVC\Settings\PublicConnectionTimeout
to 60 (Hexadecimal).An example registry script is shown below.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\icssvc\Settings] "PeerlessTimeoutEnabled"=dword:00000120 "PublicConnectionTimeout"=dword:00000060
-
Run the script hotspot-keep-alive.ps1.
You may optionally want to add a condition to run the task whenever you connect to the Internet. This may be done by adding a new "Trigger" to the task scheduler. Select On an event, for "Log" select Microsoft-Windows-NetworkProfile/Operational, for Source select NetworkProfile, for Event ID enter 10000 (enter 10001 for network disconnect instead of connect). Checkmark Delay task for and select 30 seconds.
An easy script to keep the Windows 10 mobile hotspot turned on even if it becomes disabled.
I now know why it didn't work in Windows 11 (W10 did). Now I'm not writing about the Task Scheduler part, but about whether the hotspot.ps1 file has permissions to activate the hotspot, and you need to check that before playing with the Task Scheduler. The procedure described above by @fuegolin1 helped (thank you), I'll translate it into English and shorten it:
If you also have a problem with Task Scheduler like I did, I googled a bit and this is how it works on my two PCs with Win 10 and 11:
place the hotspot.ps1 file in C:\script\
TASK SCHEDULER:
Task Scheduler Library > right click > Create Task
General tab:
Name: fill in
Run whether user is logged on or not: select
Run with highest privileges: check
Triggers tab:
New...
Begin the task: At startup
Delay task for: 1 minute
Stop task if it runs longer than: 30 minutes
Enabled (bottom): check
Actions tab:
New...
Action: Start a program
Program/script: Powershell
Add arguments: -noprofile -ExecutionPolicy Bypass -File "C:\script\hotspot.ps1"
Conditions tab:
Stop if the computer switches to battery power: uncheck
Start the task only if the computer is on AC power: uncheck
click OK and then enter the account password
Once you have done this, the hotspot should turn on after pressing OK, so check your Windows settings to see if that happened. If it did, try restarting your PC and see if it turns on. On both of my PCs, the hotspot takes longer to turn on after a restart. It took about 1 minute for the button in the hotspot settings to switch to the on position (sometimes it would turn off/on/off/on a few times but then it stayed on), even though I have fast computers.