OS: Vista enterprise
When i switch between my home and office network, i always face issues with getting connected to the network. Almost always I have to use the diagnostic service in 'Network and sharing center' and the problem gets solved when i use the reset network adapter option.
This takes a lot of time (3-4 min) and so i was trying to find either a command or a powershell script/cmdlet which i can use directly to reset the network adapter and save myself these 5 mins every time i have to switch between the networks. Any pointers?
Run the “netsh winsock reset” command Type netsh winsock reset in your PowerShell window when ready and press Enter to run it. It will return a success message and a restart prompt.
Type ipconfig /renew and press Enter. (This will stall for a moment.) Type netsh int ip reset and press Enter.
At the command prompt, run the following commands in the listed order and then check to see if that fixes your connection problem: Type netsh winsock reset and press Enter. Type netsh int ip reset and press Enter. Type ipconfig /release and press Enter.
You can use WMI from within PowerShell to accomplish this. Assuming there is a network adapter who's device name has Wireless in it, the series of commands might look something like the following:
$adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wireless*"} $adaptor.Disable() $adaptor.Enable()
Remember, if you're running this with Window's Vista, you may need to run the PowerShell as Administrator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With