Get the display resolution for all the computers listed in a text file:
# Read in the workstation names
$workstations = Get-Content "C:\scripts\workstations.txt"
foreach($pc in $workstations) {
# Ping the machine to see if it’s turned on
$result = Test-Connection "$pc" -quiet
if ($result) {
# Get the display details via CIM
$displays= Get-CIMinstance -class "Win32_DisplayConfiguration" -computername $pc
ForEach ($display in $displays) {
$w=$display.PelsWidth
$h=$display.PelsHeight
"$pc Width: $w Height: $h"
"$pc Width: $w Height: $h" >>C:\scripts\DisplayRes.txt
}
} else {
"$pc : Not Responding"
"$pc : Not Responding" >>C:\scripts\DisplayRes.txt
}
}
# End
For instructions of how to download and run this script see: Run a PowerShell script.
Assuming DisplayRes.ps1 is saved in the current directory:
PS C:\scripts\> ./DisplayRes.ps1
“The possession of knowledge does not kill the sense of wonder and mystery. There is always more mystery” ~ Anais Nin
pshInfo - List Ram, Disk Space, Service pack, Uptime