Possible to use net user and get information about username on another domain?

Viewed 55239

I am wondering if it's possible to use the 'net user' command in Windows to pull up details on a user in a different domain? The domain is connected to us. For example, I can log in as that user in the other domain from the same network.

This is the net user command I use to pull my local details:

net user myusername /domain

Is there a way to specify a different domain name? Or are there other commands that will do something similar? I'm am wanting to use a command to verify the password expiration date on the other domain.

3 Answers

Try to issue following command in powershell

Get-ADUser "username" -Server "domaincontroller.localdomain"

No, you cannot use it that way. The /domain flag is used just for specifying that the command should be run on the primary domain controller for the domain that you are in. Otherwise, the command runs on the computer (server) where you are running the command.

https://support.microsoft.com/en-us/help/251394/how-to-use-the-net-user-command

You can, however, use PowerShell cmdlets to manage users in Active Directory. The following documentation is for the Get-AdUser cmdlet.

https://technet.microsoft.com/en-us/library/ee617241.aspx

You probably want to pass in the Identity flag and specify the full Distinguished Name for the user object. For example: -Identity "CN=SaraDavis,CN=Europe,CN=Users,DC=corp,DC=contoso,DC=com"

You can log onto a virtual machine or windows server on that domain and run the same command to get that domain user's details.

Powershell like in Matson's answer is probably the better option if you rarely have machines open on that domain, but if you are already working on a machine in that domain your command works just fine.

Related