**Disclosure: This post contains affiliate links. If you make a purchase through these links, we may earn a small commission at no extra cost to you.
These days, most people use wireless (Wi-Fi) for their internet connections on their computers at home and maybe even at the office. Now that most computers have built in wireless capabilities, its easier just to connect to a Wi-Fi hotspot rather than try and run an Ethernet cable from your router to your PC.
Once nice feature that comes with Windows is the ability to use your PC as a Wi-Fi mobile hotspot so you can share your internet connection with other devices. This way, you can share a single connection with things such as your smartphone, tablet or other computers rather than have to connect these devices to your network. One problem you may run into though is that when you reboot your computer, you will need to enable the mobile hotspot feature manually so your other devices can once again connect to your shared connection. In this article, we will be showing you how to automatically enable the wireless (Wi-Fi) mobile hotspot in Windows 11 on startup.
To begin, you will need to make sure that the mobile hotspot is disabled or turned off on your computer. To do so, open the Windows settings and go to Network & internet and find the Mobile hotspot option and turn it off if it is not already disabled.
The next step in the process of enabling the wireless mobile hotspot in Windows on startup is to run a PowerShell script as a scheduled task that can be downloaded here.
You can view the PowerShell script by opening it in another app such as Notepad. The contents of this script is shown below.
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq ‘AsTask’ -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq ‘IAsyncOperation`1’ })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
Function AwaitAction($WinRtAction) {
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq ‘AsTask’ -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0]
$netTask = $asTask.Invoke($null, @($WinRtAction))
$netTask.Wait(-1) | Out-Null
}
Function SetHotspot($Enable) {
$connectionProfile = [Windows.Networking.Connectivity.NetworkInformation,Windows.Networking.Connectivity,ContentType=WindowsRuntime]::GetInternetConnectionProfile()
$tetheringManager = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager,Windows.Networking.NetworkOperators,ContentType=WindowsRuntime]::CreateFromConnectionProfile($connectionProfile)
if ($Enable -eq 1) {
if ($tetheringManager.TetheringOperationalState -eq 1)
{
“Hotspot is already On!”
}
else{
“Hotspot is off! Turning it on”
Await ($tetheringManager.StartTetheringAsync()) ([Windows.Networking.NetworkOperators.NetworkOperatorTetheringOperationResult])
}
}
else {
if ($tetheringManager.TetheringOperationalState -eq 0)
{
“Hotspot is already Off!”
}
else{
“Hotspot is on! Turning it off”
Await ($tetheringManager.StopTetheringAsync()) ([Windows.Networking.NetworkOperators.NetworkOperatorTetheringOperationResult])
}
}
}
Function ToggleHotspot($Delay) {
SetHotspot(1)
sleep -seconds $Delay
SetHotspot(0)
sleep -seconds $Delay
SetHotspot(1)
}
ToggleHotspot(3)
Once you have the script downloaded, put it in a location where you want to keep it because if you move it later, you will need to adjust the location in the following steps to make it work again. We will place the script in the C:\MyFiles\ directory.
Creating a Scheduled Task to Automatically Enable the Wi-Fi Mobile Hotspot
To enable the wireless mobile hotspot to start automatically with Windows, we will now open Task Scheduler and create a new scheduled task. For the name we will enter Hotspot but you can name yours whatever you like. The task will run with the logged in user account so if you want to change it to another account, you will need to click on the Change User or Group button and enter the new username and password for the account you wish to use.
On the Triggers tab, we will set the task to run on startup and delay the task for one minute to give Windows time to finish loading. We will also set the task to stop if it runs more than 30 minutes.
Now we will go to the Actions tab and add a new action. For the action we will select Start a program. Then in the box labeled Program/script we will type in powershell.exe. Then for the argument, we will enter the path to the script as well as the script name itself.
The Conditions and Settings tabs can stay with the default settings unless you need to change something for some reason.
Now you should see your new hotspot scheduled task along with any other configured tasks you may have in the Windows Task Scheduler.
The next time you restart your computer, the task should run and enable the wireless mobile hotspot in windows at startup. You can go back to the Windows settings to verify that the mobile hotspot has been enabled after you restart your computer.
You may also want to check out this article on how to prevent your mobile hotspot from turning itself off by itself.
For additional training resources, check out our online IT training courses.