Function Name: Get-LoggedIn

Function Name: Get-LoggedIn

 

# ——————————————-
# Function Name: Get-LoggedIn
# Return the current logged-in user of a remote machine.
# ——————————————-
function Get-LoggedIn {
[CmdletBinding()]
param (
[Parameter(Mandatory=$True)]
[string[]]$computername
)

foreach ($pc in $computername){
$logged_in = (gwmi win32_computersystem -COMPUTER $pc).username
$name = $logged_in.split(“\”)[1]
“{0}: {1}” -f $pc,$name
}
}

3 Comments

  1. Awsome article and right to the point. I don’t know if this is in fact the best place to ask but do you people have any ideea where to employ some professional writers? Thank you 🙂

Leave a Reply

Your email address will not be published.