Auto Add

Wednesday, 23 September 2015

Get the username of a person logged onto a computer remotely using PowerShell and WMI

If you want to verify the remote user in your Network or someone hammering the internet.
first we need to verify the local Network to enabled netflow on their Cisco router to do a show top-talkers. Once we got an IP address we were able to find the machine, but not who.  So I quickly entered the following into PowerShell and got the person we were after (change COMPUTERNAME to the target machine name).

   
  • Get-WmiObject Win32_ComputerSystem -ComputerName "COMPUTERNAME" |
  •  Select-Object -ExpandProperty UserName

You will need to have admin rights on the target machine for the above to work.

Another way you can do it is to use wmic to achieve the same result, enter the below into a command prompt window, changing COMPUTERNAME to the target machine.

   
  • wmic.exe /node:COMPUTERNAME computersystem get username
  This powershell Command will help you out culprit, on your Network. so that you can restrict your Intranet/Internet. 


Thanks



Srikanth Goud
Virtualization Administrator                  
 

 

No comments:

Post a Comment

Microsoft Intune, a Compliance Policy

  In Microsoft Intune, a Compliance Policy is a set of rules and settings that a device must meet to be considered "healthy" and ...