Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 591
Prox Avatar asked Sep 19 '17 23:09

Prox


People also ask

What is net user command used for?

Adds or modifies user accounts, or displays user account information. Net user is a command-line tool that is built into Windows Vista. To run net user, open a command prompt, type net user with the appropriate parameters, and then press ENTER. For examples of how this command can be used, see Examples.

What is net user command in Linux?

The net user command is used to add, remove, and make changes to the user accounts on a computer, all from the Command Prompt. The net user command is one of many net commands. You can also use net users in place of net user. They're completely interchangeable.


2 Answers

Try to issue following command in powershell

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

like image 160
matson kepson Avatar answered Sep 18 '22 16:09

matson kepson


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"

like image 38
Jenn Briden Avatar answered Sep 16 '22 16:09

Jenn Briden