Quickie one liner; get-adcomputer -filter * | Where { Test-Connection $_.name -count 1 -quiet } | Select @{Name=”Computername”;Expression={$_.Name}} Reference : https://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet
Tag: OneLiner
Find all RDP (and Console) Sessions in the Domain
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}
Find the OS of all Computers in the Domain
Quickie one liner Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemService Pack,OperatingSystemVersion -Wrap –Auto Reference: https://serverfault.com/questions/585223/how-to-list-all-computers-operating-system-on-a-network-in-powershell