# ServicePack2.ps1 filter getversion { $wmi = Get-WmiObject win32_operatingsystem -property servicepackmajorversion -computer $_ $sp = $wmi.servicepackmajorversion write-host "$_ : $sp" } get-content "c:\computers.txt" | getversion