Fixing Wireless Connectivity Issues with PowerShell

If you're experiencing wireless connectivity issues, this PowerShell script can help resolve the problem by restarting the WWAN service and deleting a rogue Network Controller device from Device Manager.

Prerequisites


The Script

This script consists of four main sections: stopping the WWAN service, launching Device Manager, deleting a rogue device from Other devices in Device Manager, and restarting the WWAN service.

stop-service -name WwanSvc -verbose -force

How It Works

Stopping the WWAN Service

The script starts by stopping the WWAN service using the `Stop-Service` cmdlet. This is done to prevent any network connections from being lost during the maintenance process.

start-process DEVMGMT.msc -Wait

Launching Device Manager

The script then launches Device Manager using the `Start-Process` cmdlet, which allows you to interact with the device manager window.

#Delete the Network Controller device from Other devices in Device Manager
pnputil.exe /scan-devices

Deleting the Rogue Device

The script then uses the `Pnputil.exe` utility to scan for and delete a rogue Network Controller device from Other devices in Device Manager. This is done to prevent any network connectivity issues.

start-service -Name WwanSvc -Verbose

Restarting the WWAN Service

The script finally restarts the WWAN service using the `Start-Service` cmdlet, which ensures that all network connections are re-established.

Key Code Snippets

stop-service -name WwanSvc -verbose -force
start-process DEVMGMT.msc -Wait
#Delete the Network Controller device from Other devices in Device Manager
pnputil.exe /scan-devices
start-service -Name WwanSvc -Verbose

Usage Examples

To use this script, simply copy and paste it into your PowerShell console or save it to a file and run it as an administrator. The script will then stop the WWAN service, launch Device Manager, delete any rogue devices, and restart the WWAN service.

Conclusion

This PowerShell script provides a simple way to resolve wireless connectivity issues by restarting the WWAN service and deleting any rogue Network Controller devices from Device Manager. By following this script, you should be able to troubleshoot and fix common wireless connectivity problems on your Windows system.

View the Fix-Wifi.ps1 script on GitHub