Network map

The following is a powershell script to list all devices on the network. It will list the name ipaddress and whether it is online or offline. It uses a file called c:\machinelist.txt. This file contains a list of all machine names on the network. I hope this might help those with limited network experience.

Note the output spacing is off some spaces have been removed

$Computers = Get-Content -Path “c:\Temp\MachineList.txt”
foreach ($ComputerName in $Computers) {
$IP=" "
Trap { Continue }
$V=Test-Connection $computername -erroraction SilentlyContinue -Count 1
if (-not [string]::IsNullOrEmpty($V)) {
WRITE-HOST “$name - $IP - ONLINE” -ForegroundColor GREEN
} else {
WRITE-HOST “$name - - OFFLINE” -ForegroundColor RED

1 Like


Thank you for sharing this. This might help other users.