Testing network connectivity
Posted by: Richard Siddaway
One of the standard troubleshooting tasks when investigating a problem is deciding if the machine can communicate on the network. The approach is usually
- ping the loop back address to check TCP/IP is working
- ping the machines own address
- ping the default gateway
- ping other servers
This means running ipconfig to discover some of the information and then running pings
|
001
002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 |
function test-networkconnectivity {
[CmdletBinding()] param() $nic = Get-WmiObject Win32_NetworkAdapterConfiguration ` Write-Verbose "TCP/IP Stack" Write-Verbose "Local Address" Write-Verbose "Default Gateway" Write-Verbose "DNS Server" } |
We can simplify this action. Use WMI to get the data (I’m assuming we are doing this on a client) from the DHCP enabled NIC. I added the filter for IPEnabled to filter out BlueTooth adapters.
We can then use Test-Connection to perform the pings. The various results are labelled accordingly if we use the –verbose switch
test-networkconnectivity -Verbose




