简体   繁体   English

域控制器未在PowerShell中更新Get-ADUser

[英]Domain controller not updating Get-ADUser in powershell

When looking up an account using net user jsmith /domain it will display all the current info about a user and it's password. 使用net user jsmith /domain查找帐户时,它将显示有关该用户的所有当前信息及其密码。 When I look it up using powershell with Get-ADUser , the information is not accurate. 当我使用Powershell和Get-ADUser进行查找时,信息不准确。 I am guessing this is because they are pointing to a different domain controller, and one did not catch up yet? 我猜这是因为他们指向的是另一台域控制器,而没有赶上吗?

Question is: What domain controller is net user using? 问题是:净用户正在使用哪个域控制器? So that I may make Get-ADUser use the same one. 这样我就可以使Get-ADUser使用相同的对象。

Better yet, how can I find the fastest domain controller? 更好的是,如何找到最快的域控制器?

So I was wrong about my assumption see Robert's Answer . 所以我错了我的假设,请参阅Robert's Answer Using that knowledge properly I can salvage this answer. 正确使用这些知识,我可以挽救这个答案。

So, If you want cohesion between the net user and Get-Aduser you could try something like this: 因此,如果您想要net userGet-Aduser之间的凝聚力,可以尝试如下操作:

$pdc = (((nltest /dclist:domainname | ?{$_ -match "\[PDC\]"}).Trim()) -Split '\s')[0]
Get-ADUser -Identity someguy -Server $pdc

As for picking the fastest domain controller your computer should have already been told which controller is appropriate for it to use. 至于选择最快的域控制器,您的计算机应该已经被告知哪个控制器适合使用它。 Changes you make in the same active directory site should replicate quickly. 您在同一Active Directory站点中所做的更改应快速复制。 If you are making changes across AD sites then you will have to wait as long as you have set in your site to site replication settings. 如果要在AD站点之间进行更改,则必须等待,直到您在站点中设置了站点复制设置。

The net user command, when given the /domain switch, operates on the Primary Domain Controller , which may not necessarily be your current logon server which, on the other hand, is used by Get-ADUser . 给定/domain开关时, net user命令在主域控制器上运行,该域控制器不一定是您当前的登录服务器,而另一方面,该服务器由Get-ADUser

And the reason why you are seeing different information is that replication of this change has not occured yet between these two. 您看到不同信息的原因是,这两个更改之间尚未发生此更改的复制。

  • To see your logon server, in cmd, do set logonserver . 要查看您的登录服务器,请在cmd中set logonserver
  • To see your primary domain controller (PDC), do nltest /dclist:example.org ( nltest requires some Active Directory tools to be installed, see the docs ) 要查看您的主域控制器(PDC),不nltest /dclist:example.orgnltest需要安装一些Active Directory工具, 请参阅该文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM