Hello @spapakons,
That said, is there a script I can run to automatically refresh my WiFi connection?
Is there any script I could run to do that for me? Disconnect temporarily (even for 1 sec) and then reconnect automatically so I will be able to connect remotely again?
Here is something that I wrote for ME
[ but it might help you ] that does this for Wi-Fi whenever I need to Disable
and then Enable
it.
First though, you will need to find out what the actual Wi-Fi Name
is.
To do that, in a CMD prompt, Copy & Paste
the following command and press Enter
. . .
Code:
PowerShell "Get-NetAdapter -Name * | Select Name, InterfaceDescription, Status | Format-Table -AutoSize | Out-String -Width 1000"
Then change Wi-Fi
in set "Name=Wi-Fi"
in the below Script to that of the Name
specified in the above output and save it as a .bat
file. This will work if you have more than ONE Wi-Fi adapter as you are hardcoding the Name
into the Script . . .
Code:
@echo off
if not "%1"=="max" start /max cmd /c %0 max & Exit/b
:: ###############################################
:: # Title : Check and Reset Network #
:: # Created By: Paul Black #
:: # Created On: 17-May-2022 #
:: ###############################################
set "Title=Check and Reset Network" & set "Author=Paul Black"
title %Title% - Written by %Author%.
setlocal EnableDelayedExpansion
fsutil Dirty Query %SystemDrive% > nul && goto:[RunAs]
echo CreateObject^("Shell.Application"^). ^
ShellExecute "%~0","+","","RunAs",1 > "%Temp%\+.vbs" && "%Temp%\+.vbs" & Exit
:[RunAs]
set "Name=Wi-Fi"
:Options
echo. & echo ======================================================================================================================================================================
echo %Title%.
echo ======================================================================================================================================================================
echo. & echo Options:
echo. & echo [0] EXIT this Program.
echo. & echo [1] Run Current Network Status.
echo [2] Run Reset Network Adapter [ Wi-Fi ].
echo. & echo ======================================================================================================================================================================& echo.
CHOICE /N /C 012 /M ">Enter an Option number:"
if %ErrorLevel%==3 cls & goto :Reset_Wi-Fi
if %ErrorLevel%==2 cls & goto :Check_Network_Status
if %ErrorLevel%==1 Exit
:Check_Network_Status
echo. & echo Processing [ Current Network Status ] . . .
echo. & echo ----------------------------------------------------------------------------------------------------------------------------------------------------------------------& echo.
wmic nic get name, index
netsh interface show interface
ipconfig /all
echo. & echo ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
echo. & echo Processing Complete.
echo. & echo ^>Press ANY key to return to the Options . . . & pause >nul & cls & goto :Options
:Reset_Wi-Fi
echo. & echo Processing [ Resetting Network Adapter ] . . .
echo. & echo ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
netsh interface set interface "%Name%" disable >nul
netsh interface set interface "%Name%" enable & timeout /t 3 /nobreak >nul
echo Current Network Adapter Status:
netsh interface show interface
echo ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
echo. & echo Processing Complete.
echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
I hope this helps.