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
Post a Comment