Tuesday, October 23, 2012

Use WMIC to get logged in user from remote computer

The Command:

C:\>WMIC /NODE:’Hostname' ComputerSystem Get Username,Name

The Results:

Name           UserName

Hostname  Domain\User.Name

 

The node can be the DNS name, or IP Address, also a list can be used as well.

I would have really liked to use this command to query thousands of nodes, however through experimentation the tool seemed to crash after 30 or 40 hosts.

I tried the /FAILFAST:ON and /FAILFAST:50 options with some improvements, but nothing solid.

Please comment if you have used this tool successfully for a large list of nodes.

Thanks!

 

List Computers in a domain

dsquery computer domainroot -name ws* -o rdn

 

By default this will be limited to 100 results, use the –limit option to display more results.