# initial status bar Write-Progress -activity "Getting inventory" -status "Starting" -id 1 # get computer names $computers = Get-Content c:\computers.txt # how many computers? $qty = $computers | Measure-Object $currentComputer = 1 foreach ($computer in $computers) { # calculate status [int]$pct = ($currentComputer / $qty.count) * 100 # update status bar Write-Progress -activity "Getting inventory" -status $computer -id 1 -percent $pct # get service pack Write-Progress -activity "Getting inventory" -status $computer -id 1 -percent $pct ' -current "Service Pack" $wmi = gwmi win32_operatingsystem -computer $computer write 'n write $computer write "Service Pack: " $wmi.servicepackmajorversion # get disks Write-Progress -activity "Getting inventory" -status $computer -id 1 -percent $pct ' -current "Disks" $wmi = gwmi win32_logicaldisk -computer $computer Write-Host "Logical disks: " foreach ($disk in $wmi) { write $disk.deviceid } # next computer... $currentComputer++ }