Hello everyone. Welcome to the 3rd part of mining monitoring tutorial series.If you have an unstable Internet connection which goes down any time then this article is for you. If Internet connection goes down then my script will reset the network adaptor and try to connect to a different Internet Connection available.
I don’t have a stable Internet connection that’s why I have 2, active Internet connections. So whenever my current Internet connection goes down then I would want my mining rig to connect automatically to the other Internet connection. Sometime network adapter reset is sufficient to bring the Internet up.
Everything will be done automatically.All you need to do is run the script provided, sitback and relax.
Prerequisite : Must check Part 1 and Part 2 of this tutorial series :
Part 1 : How to automatically restart miner after crash
Part 2 : Get Email Notification if Miner Goes Down
Part 4 : Restart System if Hangs up
Auto Connect to Different Internet Connection
- Download script package Part 1 + Part 2 + Part 3
- Configure as per Previous Parts of this tutorial series.
- Following powershell code will handle two different Wi-Fi networks
#Enter your network names $Network_1_Name = "Airjaldi*" $Network_2_Name = "Jio Hotspot*" if (Test-Connection google.com -Count 1) { Write-Host "Internet is Working Fine"} else { Write-Host "Problem with Internet Connection" $Current_Network_Name = (get-netconnectionProfile).Name if ($Current_Network_Name -eq $Network_1_Name ) { Restart-NetAdapter -Name "Wi-Fi*" Start-Sleep 10 netsh wlan connect name = $Network_2_Name } else { Restart-NetAdapter -Name "Wi-Fi*" Start-Sleep 10 netsh wlan connect name = $Network_1_Name } }
- Considering you have made changes as per part 1 and part 2 of this tutorial series. All you need to change here is Network_1_Name and Network_2_Name
- For you, scenario might be different like 2 Ethernet Connections, One Ethernet and One WiFi. You have to make changes to above code accordingly. Don’t hesitate to ask in comments for any help.
- That is it. It was a very small script but very helpful for anyone who has an unstable internet connection.
Some Custom Changes
If you have One Ethernet Internet Connection and one Wi-Fi Internet Connection.
1. Set Network_1_Name to your Ethernet connection name.
2. Set Network_2_Name to your WiFi connection name.
3. In above script after ” if ($Current_Network_Name -eq $Network_1_Name ) { ” add this
Disable-NetAdapter -Name "Ethernet*"
4. After ” netsh wlan connect name = $Network_2_Name } else { ”
replace ” Restart-NetAdapter -Name “Wi-Fi*” Start-Sleep 10 netsh wlan connect name = $Network_1_Name ” with
Enable-NetAdapter -Name "Ethernet*"
If you have Two Ethernet Internet Connections
1. In above script after “$Current_Network_Name = (get-netconnectionProfile).Name ” remove everything and add following
if ($Current_Network_Name -eq $Network_1_Name ) { Disable-NetAdapter -Name "Ethernet 1" Start-Sleep 10 Enable-NetAdapter -Name "Ethernet 2" } else { Disable-NetAdapter -Name "Ethernet 2" Start-Sleep 10 Enable-NetAdapter -Name "Ethernet 1" } }
2. You have to change Ethernet adapter name. To know the Ethernet adapter names
3. Open control panel >> Network and Internet >>Network Connections >> Change Adapter Settings. Check image below for reference
Part 3 of this mining monitoring series is complete.For any doubts or query use comment box below.
I write about Crypto mining, trading, referral programs. I have been in the cryptocurrency industry for the last 4 years.
Leave a Reply