This is the script that I have
Import-Module activedirectory
$rtn = $null
$time = (Get-Date).AddDays(-30)
Get-ADComputer -Filter {modified -lt $time -and OperatingSystem -like 'Windows 7*'}|ForEach-Object {
$rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet
if($rtn -match 'True') {
write-host -ForegroundColor green $_.dnshostname
}
else {
Write-host -ForegroundColor red $_.dnshostname
"$_.dnshostname"| out-file -File 'c:\users\tony\desktop-Append
}
}
So far it works like it suppose to but I want to be 100 percent sure that the machine that are given to me on the text file are offline what is another command to verify that the machine is offline.