• Skip to main content
  • Skip to primary sidebar

JKCrypto

Part 3 : Connect to Different Network if No Internet

April 20, 2020 by Anuj Saini Leave a Comment

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 

  1.  Download script package Part 1 + Part 2 + Part 3
  2. Configure as per Previous Parts of this tutorial series.
  3. 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
            }
         
          }

     

  4. 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
  5.  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.
  6. 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.

Anuj Saini

I write about Crypto mining, trading, referral programs. I have been in the cryptocurrency industry for the last 4 years.

Filed Under: Monitoring Tagged With: auto connect, auto mining, auto script, automated mining script, automatic, automation, batch script, connect to different internet, crypto mining, how to guide, internet down, miner down monitor, mining, mining monitoring, mining tracking, monitor miner, monitoring, powershell script

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Search

Recent

  • Binance Futures Referral Code: JKCRYPTO, Free $500 Welcome Bonus
  • AAX Referral Code: WNvPmcxA2Qo6, Earn 40% Referral Commission
  • OKEx Referral Program : $10 On Signup + Referral Bonus
  • FTX Referral Program : 30% referral commission + 5% fee Discount for Referrals
  • Binance Referral Code: 10186109, 25% Discount

More to See

Binance Futures New Users

Binance Futures Referral Code: JKCRYPTO, Free $500 Welcome Bonus

AAX Referral Code: WNvPmcxA2Qo6, Earn 40% Referral Commission

okex exchange

OKEx Referral Program : $10 On Signup + Referral Bonus

FTX Feature Image

FTX Referral Program : 30% referral commission + 5% fee Discount for Referrals

Bitcoin, Altcoins, Referral Codes, Mining, Crypto News