0

Here is my code

# Create New  Domain Controller Import-Module ADDSDeploymentInstall-ADDSDomainController -InstallDns -Credential (Get-Credential BPLTest.lab\Administrator) -DomainName "BPLtest.lab"  -NoGlobalCatalog:$false   -InstallDns:$True   -CreateDnsDelegation:$false   -CriticalReplicationOnly:$false   -DatabasePath "C:\NTDS"   -LogPath "C:\NTDS"   -SysvolPath "C:\SYSVOL"   -NoRebootOnCompletion:$false   -SiteName "Default-First-Site-Name"   -Force:$true

Now this code should install a domain controller into the my BPLTest.lab domain in my lab. I have run the ad prerequistes and also added RSAT tools for AD in another prior script. They work perfectly. However this script will install domain controller but I cant get it adjust things like the SysvolPath, DatabasePath and logpath. It keeps telling me it doesnt recognise these cmdlets. ANy ideas what I am doing wrong

TessellatingHeckler's user avatar
TessellatingHeckler
29.3k4 gold badges55 silver badges96 bronze badges
askedSep 30, 2016 at 19:32
Paul Drummond's user avatar

1 Answer1

1

PowerShell will assume theInstall-ADDSDomainController line is complete and won't look on the next lines for more parameters.

You need totell it there is more to the command by ending a line with a backtick:

#Create New  Domain Controller Import-Module ADDSDeploymentInstall-ADDSDomainController -InstallDns -Credential (Get-Credential BPLTest.lab\Administrator) -DomainName "BPLtest.lab" `  -NoGlobalCatalog:$false `  -InstallDns:$True `  -CreateDnsDelegation:$false `  -CriticalReplicationOnly:$false `  -DatabasePath "C:\NTDS" `  -LogPath "C:\NTDS" `  -SysvolPath "C:\SYSVOL" `  -NoRebootOnCompletion:$false `  -SiteName "Default-First-Site-Name" `  -Force:$true

Or by putting the variables into a dictionary of parameters first, and then 'splatting' them into the cmdlet as described here:https://stackoverflow.com/a/24313253/478656

answeredSep 30, 2016 at 20:20
TessellatingHeckler's user avatar
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks its working now and you notice I had -InstallDNS twice so I just had to remove one. its working now

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.