WIFI auto connect for HTPC in server 2016 standard

0

I have a htpc that connects to the internet using WIFI as well as gets it lan connectivity through WIFI. Its running server 2016 standard. The machine is set to connect automatically however, when there is a power outage, the machine on a UPS loses signal with the AP which isint on a UPS. I would like the machine to check for the SSID and reconnect to wifi once the AP is back and broadcasting its SSID

I have successfully setup a scheduled task that executes when the event 8003(when the machine loses wifi signal) is posted on the WLAN autoconfig operational log. The command

netsh wlan connect ssid=xxxxx name=yyyyy

Where xxxxx is the known wifi profile on the machine and yyyyy is the wifi ssid

The task works fine, but there is a critical step missing that I dont quite know how to work out. This is what I need to happen

1) event 8003 is posted in the log

2) The task executes and attempts to connect

3) Task is complete

4) Ping 8.8.8.8 (or any other IP) for internet connectivity test

5) If no response from ping, back to step 1 after 5 sec wait

6) if there is ping response stop task and wait for event 8003 to occur again

is there a simple script that can be written for this to execute without my supervision and also in the background

A few extra details:

wifi card: TP link archer T9

AP: TP link AV2000 (TL-WPA9610

HTPC OS: Server 2016 standard

trevor

Posted 2018-11-08T13:03:56.370

Reputation: 1

Answers

0

Here is a script written theoretically with no testing done:

:again
netsh wlan connect ssid=xxxxx name=yyyyy
IF %ERRORLEVEL% NEQ 0 goto wait5
Ping 8.8.8.8
IF %ERRORLEVEL% EQ 0 goto:eof
:wait5
timeout 5
goto again

harrymc

Posted 2018-11-08T13:03:56.370

Reputation: 306 093