Quantcast
Viewing all articles
Browse latest Browse all 12

Oneliner: Get Logged on Users with Powershell

Check out this oneliner/function! Provide a computer name and it will return the logged on users.

function Get-MyLoggedOnUsers
{
 param([string]$Computer)
 Get-WmiObject Win32_LoggedOnUser -ComputerName $Computer | Select Antecedent -Unique | %{“{0}{1}” -f $_.Antecedent.ToString().Split(‘”‘)[1], $_.Antecedent.ToString().Split(‘”‘)[3]}
}

Hugo


Viewing all articles
Browse latest Browse all 12

Trending Articles