Quickie one liner

$work = Get-ADComputer -filter *
$work = $work.name
foreach ($1 in $work){write-host $1 ; quser /server:$1}

This also works (courtesy of jrv [technet]);

Get-ADComputer -Filter *| ForEach-Object{ quser /server $_.Name}

Or to get a single computer

Get-ADComputer <servername> | ForEach-Object{ quser /server $_.Name}


Leave Your Comment

Your email address will not be published. Required fields are marked *

1 × four =