grant Replicate Directory Changes permission - powershell

Hi All,

is it possible to do these steps via powershell?

To grant Replicate Directory Changes permission on the cn=configuration container
1.      On the domain controller, click Start, click Run, type adsiedit.msc, and then click OK.
2.      If the Configuration node is not already present, do the following:
1.      In the navigation pane, click ADSI Edit.
2.      On the Action menu, click Connect to.
3.      In the Connection Point area of the Connection Settings dialog box, click Select a well know Naming Context, select Configuration from the drop-down list, and then click OK.
3.      Expand the Configuration node, right-click the CN=Configuration... node, and then click Properties.
4.      In the Properties dialog box, click the Security tab.
5.      In the Group or user names section, click Add.
6.      Type the name of the synchronization account, and then click OK.
7.      In the Group or user names section, select the synchronization account.
8.      In the Permissions section, select the Allow check box next to the Replicating Directory Changes (Replicate Directory Changes on Windows Server 2003) permission, and then click OK.
Kelly GarciaSenior Systems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zac HarrisSystems Administrator Commented:
This should help you out...

$Identity = "domain\account"
$RootDSE = [ADSI]"LDAP://RootDSE"
$DefaultNamingContext = $RootDse.defaultNamingCont<wbr ></wbr>ext
$ConfigurationNamingContex<wbr ></wbr>t = $RootDse.configurationNami<wbr ></wbr>ngContext
$UserPrincipal = New-Object Security.Principal.NTAccou<wbr ></wbr>nt("$Ident<wbr ></wbr>ity")
DSACLS "$DefaultNamingContext" /G "$($UserPrincipal):CA;Repl<wbr ></wbr>icating Directory Changes"
DSACLS "$ConfigurationNamingConte<wbr ></wbr>xt" /G "$($UserPrincipal):CA;Repl<wbr ></wbr>icating Directory Changes"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.