Reputation: 759
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.
Upvotes: 20
Views: 92607
Reputation: 3
I followed this command on PowerShell and it worked well for me :) Just replace the "username" and "servername" to your respective case.
Get-ADUser -identity username -Server servername -properties passwordlastset, passwordneverexpires | sort name | ft Name, passwordlastset, Passwordneverexpire
Upvotes: 0
Reputation: 37
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.
Upvotes: 1
Reputation: 3231
Try to issue following command in powershell
Get-ADUser "username" -Server "domaincontroller.localdomain"
Upvotes: 6
Reputation: 81
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"
Upvotes: 7