[英]adding a domain controller by powershell script
Here is my code 这是我的代码
# Create New Domain Controller
Import-Module ADDSDeployment
Install-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. 现在,此代码应将域控制器安装到我的实验室的BPLTest.lab域中。 I have run the ad prerequistes and also added RSAT tools for AD in another prior script.
我已经运行了广告前提条件,并在另一个先前的脚本中添加了用于AD的RSAT工具。 They work perfectly.
他们工作完美。 However this script will install domain controller but I cant get it adjust things like the SysvolPath, DatabasePath and logpath.
但是,此脚本将安装域控制器,但我无法调整它,例如SysvolPath,DatabasePath和logpath。 It keeps telling me it doesnt recognise these cmdlets.
它一直告诉我它不识别这些cmdlet。 ANy ideas what I am doing wrong
知道我在做什么错
PowerShell will assume the Install-ADDSDomainController
line is complete and won't look on the next lines for more parameters. PowerShell将假定
Install-ADDSDomainController
行已完成,并且不会在下一行查找更多参数。
You need to tell it there is more to the command by ending a line with a backtick: 您需要通过以反引号结束一行来告诉命令还有更多内容 :
#Create New Domain Controller
Import-Module ADDSDeployment
Install-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 或先将变量放入参数字典中,然后按以下说明将它们“撒”入cmdlet: https : //stackoverflow.com/a/24313253/478656
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.