Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at <a href="https://stackoverflow.com/questions/3859969/powershell-script-failing-becuase-ad-objects-have-not-replicated-soon-enough?rq=1">PowerShell: Script failing because AD objects have not replicated soon enough</a>. I'm having the same problem too and I'll try to figure it out over the next few days. If I find anything useful, I'll update this answer. This <a href="http://ss64.com/ps/set-addomainmode.html" rel="nofollow noreferrer">http://ss64.com/ps/set-addomainmode.html</a> may be useful but I'm not sure yet.</p> <p>Edit: I wrote a cmdlet that waits for an AD object to propagate to all the domain controllers.</p> <pre><code>&lt;# .SYNOPSIS Wait for an AD object to propagate to all domain controllers. .DESCRIPTION This cmdlet enumerates the domain controllers in the current domain and polls each one in turn until the specified object exists on each one. If the object doesn't propagate completely inside the timeout time span, the cmdlet will throw a System.TimeoutException. .PARAMETER LDAPFilter The LDAP filter used to locate the object. .PARAMETER Timeout The time span this command should wait before timing out. .NOTES Author: Alex Barbur &lt;alex@barbur.net&gt; #&gt; function Wait-ADObject { [CmdletBinding(SupportsShouldProcess=$True)] param ( [Parameter(Mandatory=$True)] [string]$LDAPFilter, [TimeSpan]$Timeout = '00:00:30' ) # calculate when we should stop $stop = $(Get-Date) + $Timeout Write-Verbose "Will check until $stop" # iterate through the domain controllers $domain = Get-ADDomain foreach ($server in $domain.ReplicaDirectoryServers) { # wait for the object to replicate Write-Verbose "Checking $server" $object = $Null while($object -eq $Null) { # check if we've timed out $left = New-TimeSpan $(Get-Date) $stop if($left.TotalSeconds -lt 0) { # timeout throw [System.TimeoutException]"Object propagation has timed out." } # wait a bit and check again Start-Sleep -Milliseconds 250 $object = Get-ADObject -LDAPFilter $LDAPFilter -Server $server } } } </code></pre> <p>And you can use it like this.</p> <pre><code>Import-Module ActiveDirectory New-ADUser -SamAccountName 'doe.1' Wait-ADObject -LDAPFilter '(sAMAccountName=doe.1)' </code></pre> <p>Hopefully it's useful to someone.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload