Created
April 8, 2019 18:16
-
-
Save quonic/0d0474542674b55c455682a950c55aca to your computer and use it in GitHub Desktop.
Untested: This will sync AD on all Domain Controllers
This file contains 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
Function Sync-AD { | |
Param( | |
[Credential] | |
$Credential=$(Get-Credential) | |
) | |
$splatme = @{ | |
ComputerName = Get-ADDomainController -Filter {Name -like "*"} | |
ScriptBlock = { | |
Import-Module -Name 'ADSync' | |
Start-ADSyncSyncCycle -PolicyType Delta | |
} | |
Credential = $Credential | |
} | |
Invoke-Command @splatme | |
} | |
Sync-AD -Credential $([System.Net.CredentialCache]::DefaultNetworkCredentials) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment