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:$trueNow 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
1 Answer1
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:$trueOr 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
1 Comment
Explore related questions
See similar questions with these tags.

