How to find logon user name on domain computer using power shell command

To find out which user is logged on to a domain computer, we can use one line power shell command.
Open PowerShell on Domain Controller or Management PC.

Click Start – Search – Windows PowerShell.
Right Click on PowerShell and Click on run as administrator.

Type below command to get the logged on username.

Get-WmiObject –ComputerName “Computername” –Class Win32_ComputerSystem | Select-Object UserName

Example: Get-WmiObject –ComputerName testmachine –Class Win32_ComputerSystem | Select-Object UserName

You will get the below output.

UserName
TEST/John.Smith

Comments

Popular posts from this blog

The System could not log you on. The revocation status of the smart card certificate used for authentication could not be determined

Unblock gemalto .net smart cards using Gemalto response calculator

How to check who killed process in windows