A PowerShell setup script that configures Windows Mobile Hotspot to turn on automatically at every boot and stay on — even if it gets switched off unexpectedly.
The script runs through 6 steps:
- Sets execution policy — enables local scripts to run by setting
RemoteSignedfor the current user. - Prompts for hotspot credentials — asks for an SSID (network name) and a password (minimum 8 characters, validated interactively).
- Generates
HotspotKeepAlive.ps1— writes a self-contained keepalive script toC:\Scripts\that uses the Windows Runtime networking API to check the hotspot state every 30 seconds and re-enable it if it's found to be off. - Registers a Scheduled Task — creates a Windows Task Scheduler entry (
HotspotKeepAlive) that runs the keepalive script at startup as theSYSTEMaccount with the highest privileges. The task runs indefinitely, restarts up to 3 times on failure (1-minute interval), and continues running on battery. - Starts the task immediately — kicks off the keepalive loop right away without requiring a reboot.
- Reports status — confirms the task is running and displays the configured SSID and password.
- Windows 10 or 11 with Mobile Hotspot capability
- PowerShell 5.1+ (built into Windows)
- Administrator privileges — required to register the Scheduled Task under the
SYSTEMaccount
- Right-click PowerShell and select Run as Administrator.
- Navigate to the folder containing the script:
cd C:\path\to\script
- Run the installer:
powershell -ExecutionPolicy Bypass -File .\InstallHotspotTask.ps1
- Follow the prompts to enter your desired hotspot name and password.
That's it — the hotspot will now auto-enable on every boot.
| Path | Description |
|---|---|
C:\Scripts\HotspotKeepAlive.ps1 |
The generated keepalive script (do not delete) |
Task Scheduler → HotspotKeepAlive |
The scheduled task that runs the keepalive at startup |
| Action | Command |
|---|---|
| Check task status | Get-ScheduledTask -TaskName "HotspotKeepAlive" |
| Stop the task | Stop-ScheduledTask -TaskName "HotspotKeepAlive" |
| Remove the task | Unregister-ScheduledTask -TaskName "HotspotKeepAlive" -Confirm:$false |
- The generated
HotspotKeepAlive.ps1has your SSID and password embedded in plain text. KeepC:\Scripts\access restricted if you're on a shared machine. - The keepalive loop checks every 30 seconds. There may be a brief window after boot before the hotspot is confirmed active.
- If no active internet connection profile is found at check time, the script logs a message and retries on the next cycle.
- Re-running
InstallHotspotTask.ps1will overwrite the existing task and regenerate the keepalive script with new credentials.