windows 可以使用 net user 并获取有关另一个域上的用户名的信息吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46311117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Possible to use net user and get information about username on another domain?
提问by Prox
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.
我想知道是否可以在 Windows 中使用“net user”命令来提取不同域中用户的详细信息?域与我们相连。例如,我可以在同一网络的另一个域中以该用户身份登录。
This is the net user command I use to pull my local details:
这是我用来提取本地详细信息的 net user 命令:
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.
有没有办法指定不同的域名?或者还有其他命令可以做类似的事情吗?我想使用一个命令来验证另一个域上的密码到期日期。
回答by Jenn Briden
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.
不,你不能那样使用它。/domain 标志仅用于指定该命令应在您所在域的主域控制器上运行。否则,该命令将在您运行该命令的计算机(服务器)上运行。
https://support.microsoft.com/en-us/help/251394/how-to-use-the-net-user-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.
但是,您可以使用 PowerShell cmdlet 来管理 Active Directory 中的用户。以下文档适用于 Get-AdUser cmdlet。
https://technet.microsoft.com/en-us/library/ee617241.aspx
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"
您可能希望传入身份标志并为用户对象指定完整的专有名称。例如:-Identity "CN=SaraDavis,CN=Europe,CN=Users,DC=corp,DC=contoso,DC=com"
回答by matson kepson
Try to issue following command in powershell
尝试在 powershell 中发出以下命令
Get-ADUser "username" -Server "domaincontroller.localdomain"
Get-ADUser "username" -Server "domaincontroller.localdomain"