$computernames=@(
'COMPUTER1',
'COMPUTER2'
)
$computerLastLogon=foreach($computerName in $computernames){
get-adcomputer $computerName -Properties LastLogon|select Name,@{Name='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon)}}
}
$computerLastLogon|sort -Property LastLogon
Categories: