Simple Network Diagnostics Tool
# Simple Network Diagnostics Tool
function Show-Menu {
Clear-Host
Write-Host "=== Simple Network Diagnostics Tool ===" -ForegroundColor Cyan
Write-Host "1. Ping a host"
Write-Host "2. Check DNS resolution"
Write-Host "3. View IP configuration"
Write-Host "4. Test internet connectivity"
Write-Host "5. Exit"
}
function Ping-Host {
$host_name = Read-Host "Enter the host name or IP address to ping"
Write-Host "`nPinging $host_name..." -ForegroundColor Yellow
ping $host_name
}
function Check-DNS {
$dns_name = Read-Host "Enter the domain name to resolve"
Write-Host "`nResolving $dns_name..." -ForegroundColor Yellow
nslookup $dns_name
}
function View-IPConfig {
Write-Host "`nIP Configuration:" -ForegroundColor Yellow
ipconfig /all
}
function Test-Internet {
Write-Host "`nTesting internet connectivity..." -ForegroundColor Yellow
$result = Test-Connection -ComputerName "www.google.com" -Count 2 -Quiet
if ($result) {
Write-Host "Internet is accessible." -ForegroundColor Green
} else {
Write-Host "Internet is not accessible." -ForegroundColor Red
}
}
do {
Show-Menu
$choice = Read-Host "`nEnter your choice (1-5)"
switch ($choice) {
"1" { Ping-Host }
"2" { Check-DNS }
"3" { View-IPConfig }
"4" { Test-Internet }
"5" { Write-Host "Exiting program..." -ForegroundColor Yellow; break }
default { Write-Host "Invalid choice. Please try again." -ForegroundColor Red }
}
if ($choice -ne "5") {
Read-Host "`nPress Enter to continue..."
}
} while ($choice -ne "5")
This simplified Network Diagnostics Tool includes:
- A concise menu with 5 options
- Basic functions for essential network diagnostic tasks:
- Pinging a host
- Checking DNS resolution
- Viewing IP configuration
- Testing internet connectivity
- Use of simple PowerShell cmdlets and system commands
- Minimal error handling
- Easy-to-read output
This script provides a straightforward set of tools for basic network diagnostics and troubleshooting. It’s suitable for beginners or for quick checks of common network issues. The tool uses familiar commands like ping, nslookup, and ipconfig, which are widely recognized and easy to interpret.
This simplified version is more accessible for users who need to perform basic network diagnostics without the complexity of more advanced features.

Leave a Reply
Want to join the discussion?Feel free to contribute!