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

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

1 Like

Hello,

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