Skip to content

Instantly share code, notes, and snippets.

@quonic
Created April 8, 2019 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quonic/0d0474542674b55c455682a950c55aca to your computer and use it in GitHub Desktop.
Save quonic/0d0474542674b55c455682a950c55aca to your computer and use it in GitHub Desktop.
Untested: This will sync AD on all Domain Controllers
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