Created
July 29, 2023 00:22
-
-
Save ScriptingPro/34ff9cd6c783fe2f029f3541800ed61a to your computer and use it in GitHub Desktop.
AD Queries Against Each Domain Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User Attributes - Check if user attributes replicated to all DCs | |
Get-ADDomainController -Filter * -pv dc | %{get-aduser userid -server $dc.name -Properties * } | select {$dc.name}, LastBadPasswordAttempt,badPwdCount,LockedOut,PasswordLastSet | ft -AutoSize | |
# Group Members - Check if group members replicated to all DCs | |
Get-ADDomainController -Filter * -pv dc | %{Get-ADGroup groupname -server $dc.name -Properties members} | select {$dc.name}, {($_.members | Get-ADObject -server $dc.name -Properties samaccountname).samaccountname -join ","} | ft -AutoSize | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment