PowerShell Script To Retrieve the Logged On User For A Remote Machine

 

This PowerShell script will allow you to enter a remote machine name and will return the machine name and currently logged on user name and write the results to the active window.

 

PS1 Script:

 

$strComputer = "."

$Var =GWMI -Comp $strComputer -CL Win32_ComputerSystem

"Machine Name: " + $Var.Name + " User Name: " + $Var.UserName

 

 

Published Sunday, December 30, 2007 1:54 PM by dhite
Filed under:

Comments

No Comments