Share via


Add-DhcpServerInDC failes in Remoting Script

Question

Friday, April 17, 2015 8:07 AM

Hello everyone,

I am currently scripting the installation of two DHCP servers for a Windows Server 2012R2 DHCP failover cluster.
I used the technet description on how to do it.

Unfortunately the authorization of the server fails when executing the script (The script is run remotely via Invoke-Command with Domain Admin credentials):

Write-Host "Authorizing the DHCP server in the Active Directory"
if (Add-DhcpServerInDC) {
....

I have a transcript running on the remote machines that shows the following:

PS>TerminatingError(Add-DhcpServerInDC): "Failed to initialize directory service resources for domain <domain>."

When executing the Add-DhcpServerInDC command locally on the server (same user and elevated shell) I also get a warning, but the server is added (as verified with Get-DhcpServerInDC)

WARNING: The DHCP server dedam-sv0485.corp.grimme.com with IP address 10.0.202.154 has been successfully authorized in
Active Directory. Failed to initiate the authorization check on the DHCP server. Error: Access is denied.  (5).

Does anyone have an idea why the two errors occur?

Thanks in advance :)

All replies (1)

Tuesday, June 27, 2017 2:23 PM

I believe you have to be Enterprise Admin to authorize DHCP servers in AD, not just Domain Admin. 

Andreas Hultgren<br/> MCTS, MCITP<br/> <a href="http://ahultgren.blogspot.com/">http://ahultgren.blogspot.com/</a>