Note that there are some explanatory texts on larger screens.

plurals
  1. POPowerShell: Script failing because AD objects have not replicated soon enough
    text
    copied!<p>I have a script that creates two groups, a hand full of folders, and sets permissions on those folders. In my testing environment all of these processes work without issue but in my production environment I run into a problem. Setting the permissions on the folders fail since the groups I created have not replicated through all 8 of my domain controllers. Can have PowerShell work with only one of the DC's so I don't have to wait for the replication? Should I put the script to sleep for X seconds? Or is there some way to see if the groups are on all the DC's or at least on the one I am working? </p> <p>This is how I am making the groups:</p> <pre><code>New-ADGroup -Name $Admin_GRP -path "OU=Users,OU=Sandbox,DC=test,DC=local" -GroupScope Global New-ADGroup -Name $User_GRP -path "OU=Users,OU=Sandbox,DC=test,DC=local" -GroupScope Global </code></pre> <p>This is how I am setting the permissions on one of the folders:</p> <pre><code>#Set permissions on root directory $ACL = Get-Acl $PathToFolder #For Admin $Permission = $Admin_GRP,"Write,ReadAndExecute,Synchronize,DeleteSubdirectoriesAndFiles","Allow" $Access_Rule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission $ACL.AddAccessRule($Access_Rule) $ACL | Set-Acl $PathToFolder #For Users $Permission = $User_GRP,"ReadAndExecute,Synchronize","Allow" $Access_Rule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission $ACL.AddAccessRule($Access_Rule) $ACL | Set-Acl $PathToFolder </code></pre>
 

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