BAT file for Initial Diagnosis of Network Problems

Page 1 of 3 123 LastLast

  1. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #1

    BAT file for Initial Diagnosis of Network Problems


    I have updated this Post to make it easier for members to link to when helping others.

    The Batch Script is intended to be used for 'Network Diagnostics' [ or general informational purposes ]. This is only an initial step in the diagnostics process, and will allow us to rule out potential causes and problems.

    Simply download and run the following Batch file [ it will take a minute or two ].

    A special thanks to @MaloK for his input and contributions.

    UPDATED: 13-Sep-2022.

    Download

    If you would rather create your OWN Batch file, here is the code . . .

    Code:
    
    @echo off
    Title Basic Network Diagnostics Information & mode con: cols=71 lines=16
    set "LOG=Basic_Network_Diagnostics_Information.log"
    set "TFN=%Temp%\%LOG%"
    if exist %TFN% (del /f /q %TFN% >nul 2>&1)
    echo. & echo  Processing [ Collecting Basic Network Diagnostics Information ] . . .
    echo. & echo  ---------------------------------------------------------------------&>> %TFN% echo.
    >> %TFN% echo ##########################################################################################
    >> %TFN% echo # Title     : Basic Network Diagnostics Information                                      #
    >> %TFN% echo # Created By: https://www.tenforums.com/members/paul-black.html                          #
    >> %TFN% echo #           : https://www.tenforums.com/members/malok.html                               #
    >> %TFN% echo # Created On: 13-Sep-2022                                                                #
    >> %TFN% echo ##########################################################################################
    >> %TFN%      ver                                                                                       &>> %TFN% echo.
    >> %TFN% echo Started: %Date% at %Time%                                                                 &>> %TFN% echo.
    >> %TFN% echo ========================================= START ==========================================
            echo  Getting Network Information . . .
    >> %TFN% echo Network Adapter[s] Status:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      netsh interface show interface
    >> %TFN%      netsh interface ip show interfaces
    >> %TFN%      netsh mbn show interfaces
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo IP Configuration FULL [ ipconfig /all ]:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      ipconfig /all                                                                             &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo Routing Table:
    >> %TFN% echo ==========================================================================================&>> %TFN% echo.
    >> %TFN%      netstat -r                                                                                &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
            echo  Running Ping . . . 
    >> %TFN% echo Ping Loopback Adapter [ THIS Computer ]:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      ping 127.0.0.1                                                                            &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo Ping 8.8.4.4 [ dns.Google.com ]:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      ping 8.8.4.4                                                                              &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo Ping dns.Google.com:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      ping dns.google.com                                                                       &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
            echo  Running NSLookup . . .
    >> %TFN% echo NSLookup 8.8.4.4 [ dns.Google.com ]:
    >> %TFN% echo ==========================================================================================&>> %TFN% echo.
    >> %TFN%      nslookup 8.8.4.4 2>nul
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo NSLookup dns.Google.com:
    >> %TFN% echo ==========================================================================================&>> %TFN% echo.
    >> %TFN%      nslookup dns.google.com 2>nul
    >> %TFN% echo ==========================================================================================
            echo  Running TraceRT . . . 
    >> %TFN% echo TraceRT 8.8.4.4 [ dns.Google.com ]:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      tracert 8.8.4.4                                                                           &>> %TFN% echo.
    >> %TFN% echo ==========================================================================================
    >> %TFN% echo TraceRT dns.Google.com:
    >> %TFN% echo ==========================================================================================
    >> %TFN%      tracert dns.google.com                                                                    &>> %TFN% echo.
    >> %TFN% echo ========================================== EOF ===========================================&>> %TFN% echo.
    >> %TFN% echo Completed: %Date% at %Time%
    echo. & echo  ---------------------------------------------------------------------
    echo. & echo  Processing Complete.
                  start Notepad %TFN% & timeout /t 3 /nobreak >nul & del %TFN%
    echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
    
    
    

    Once the program has finished running, the results will open in Notepad.

    Please perform one of the following . . .


    I am sure that someone will be able to give you advice and help.



    Note   Note
    The following is the ORIGINAL start of this post for continuity . . .

    Good afternoon,

    We often ask for members to initially run ipconfig /all and Post the results.

    To get some additional information that might prove to be helpful at the same time that they run ipconfig /all, I wrote the following Batch Script which I use. Is there ANY reason that the results output should NOT be posted because of sensitive information etc . . .

    Code:
    
    @echo off
    :: #####################################################
    :: # Title     : Basic Network Diagnostics Information #
    :: # Created By: Paul Black                            #
    :: # Created On: 05-Feb-2022                           #
    :: #####################################################
    set "OUT=%Temp%\OUT.log"
    if exist %OUT% (del /f /q %OUT% >nul 2>&1)
    echo. & echo ^>Network Adapter[s] Status . . .
    echo. & >> %OUT% PowerShell "Get-NetAdapter -Name * | Select Name, InterfaceDescription, Status, MacAddress | Format-Table -AutoSize | Out-String -Width 1000" 2>&1
    findstr /rc:"[^ <Tab>]" %OUT% & del %OUT%
    echo. & echo ^>IP Configuration Summary . . .
    echo. & >> %OUT% PowerShell "Get-wmiObject Win32_NetworkAdapterConfiguration -Filter IPEnabled=True | Select @{L='DNS Domain Suffix';E={$_.dnsdomain}}, Description, @{L='MAC [ Physical ] Address';E={$_.macaddress}}, @{L='IP Address';E={$_.ipaddress[0]}}, @{L='Subnet Mask';E={$_.ipsubnet[0]}}, @{L='Default Gateway';E={$_.defaultipgateway[0]}}, @{L='DHCP Enabled';E={$_.dhcpenabled}}, @{L='DHCP Server';E={$_.dhcpserver}} | Out-String -Width 1000" 2>&1
    findstr /rc:"[^ <Tab>]" %OUT% & del %OUT%
    echo. & echo ^>IP Configuration FULL [ ipconfig /all ] . . .
    ipconfig /all
    echo. & echo ^>Ping THIS Computer . . .
    ping 127.0.0.1
    echo. & echo ^>Ping www.Google.com . . .
    ping www.google.com
    echo. & echo ^>Ping 8.8.8.8 [ www.Google.com ] . . .
    ping 8.8.8.8
    echo. & echo ^>TraceRT www.Google.com . . .
    tracert www.google.com
    echo. & echo ^>TraceRT 8.8.8.8 [ www.Google.com ] . . .
    tracert 8.8.8.8
    echo. & echo ^>NSLookup www.Google.com . . . & echo.
    nslookup www.google.com
    echo ^>NSLookup 8.8.8.8 [ www.Google.com ] . . . & echo.
    nslookup 8.8.8.8
    echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
    
    
    

    I have deliberately used Google TWICE on ping and tracert to give more thorough diagnostic results.

    If it is OK, then I will obviously Post it as an attachment, and possibly add the Script underneath. This way, any members that want to use it in Posts, can.

    I do NOT intend to add ANYTHING else to the above as this is just an initial collection of data results that may help with quicker diagnosis and resolution.

    Thanks.
    BAT file for Initial Diagnosis of Network Problems Attached Files
    Last edited by Paul Black; 13 Sep 2022 at 04:45.
      My Computer


  2. Posts : 7,606
    Windows 10 Home 20H2
       #2

    Paul Black said:
    sensitive information
    Is an IP address sensitive information? If so, it can be redacted via PowerShell.
      My Computer


  3. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #3

    Matthew Wai said:
    Is an IP address sensitive information?
    This is why I asked.

    One of the first things that a member is asked to run when there is a problem is ipconfig /all, which obviously contains the IP Address. When you think about it, that information will show if there is a problem straight away, and if NOT, it can be ruled out as a cause and further investigation and diagnostics can then continue.
      My Computer


  4. Posts : 48
    Win10
       #4

    The IP address returned by the ipconfig /all should not be an issue as the one returned would be an RFC1918 address in almost every instance that I can think of (there will be exceptions obviously but those would be few and far between).

    All other information for example from the tracert command is information that anyone could find so nothing of note there.
      My Computer


  5. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #5

    Hello @Calm Horizons,

    Calm Horizons said:
    The IP address returned by the ipconfig /all should not be an issue as the one returned would be an RFC1918 address in almost every instance that I can think of (there will be exceptions obviously but those would be few and far between).
    Thanks for the input. That was my thinking as the ipconfig /all results have always been posted, and I am sure that if there was a potential security risk that it would have been reported or mentioned long ago in the Threads concerned.

    Calm Horizons said:
    All other information for example from the tracert command is information that anyone could find so nothing of note there.
    I agree, I just want to try and cover all bases.
      My Computer


  6. Posts : 2,800
    Windows 7 Pro
       #6

    You could use

    Code:
    netsh interface show interface
    netsh interface ip show interfaces
    netsh mbn show interfaces
    Instead of using Powershell, it would make the script more universal. And your ipconfig /all gives all relevant info in one step.
      My Computers


  7. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #7

    Hello @MaloK,

    Thanks for the reply.

    MaloK said:
    You could use . . .
    Code:
    netsh interface show interface
    netsh interface ip show interfaces
    netsh mbn show interfaces
    Instead of using Powershell, it would make the script more universal. And your ipconfig /all gives all relevant info in one step.

    Yes, there are MANY different Commands that could be included to produce results, such as these two just as an example . . .

    Code:
    
    PowerShell "Get-NetAdapter -Name * -IncludeHidden | Select Name, InterfaceDescription, ifIndex, Status, MacAddress, LinkSpeed, DriverFileName, DriverDate, DriverVersion, NdisVersion | Sort-Object -Property Name | Format-Table | Out-String -Width 1000"
    
    PowerShell "Get-NetAdapter -Name * -IncludeHidden | Select Name, InterfaceName, AdminStatus, MacAddress, MediaType, PhysicalMediaType, ConnectorPresent | Sort-Object -Property Name | Format-Table -Autosize | Out-String -Width 1000"
    
    
    

    . . . but this is getting into a different scope of what I intended for this thread, which is to find out if ANY of the information is classed as sensitive.

    The Script is purely a quick initial way to run and produce results that can be used for diagnostics. I just thought that it would help members helping members with problems if they wanted to use and post it.
    Last edited by Paul Black; 06 Feb 2022 at 11:20.
      My Computer


  8. Posts : 7,606
    Windows 10 Home 20H2
       #8

    The code in post #1 shows my IP address, which reveals my exact location via Please Wait... | Cloudflare
      My Computer


  9. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #9

    Matthew Wai said:
    The code in post #1 shows my IP address, which reveals my exact location.
    Well, it gives the area, NOT the ACTUAL address.

    I suppose it is a case of whether people want help or NOT. I don't remember ANY members NOT wanting to post the ipconfig /all results because of this, can you Matthew?
      My Computer


  10. Posts : 48
    Win10
       #10

    Matthew Wai said:
    The code in post #1 shows my IP address, which reveals my exact location via Please Wait... | Cloudflare
    That is unusual and not what I would expect - just checked the results when I run the code and I get 192.168.0.4 address which is going to be very similar to what I would expect ninety nine times out of a hundred if not more. That is non-routable over a WAN so no issues with posting that on a public forum.

    To get the result that would be identified by Cloudflare or similar that would mean that your PC must have a public address assigned to it which is not what i would expect at all.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:07.
Find Us




Windows 10 Forums