使用脚本安装域控制器(win2008DC)

来源:互联网 发布:国产同志网络剧 编辑:程序博客网 时间:2024/05/17 23:34

 

  如今,Windows Server 2008里的Server Core没有图形用户界面(GUI)。这意味着组成dcpromo用户界面的字节不能部署在Server Core实例上。因此,将Server Core成员服务器转入Server Core DC的唯一方式是通过命令行。Server Core最小操作系统与常用的DC轻量级资源需要完美结合——尤其对于虚拟的DC来说。

  

  下面是个基础的无人化安装文件,用来创建全新的域控制器,域命名为contoso.com:

; DCPROMO unattend file (automatically generated by dcpromo)
;
[DCInstall]
; New forest promotion
ReplicaOrNewDomain=Domain
NewDomain=Forest
NewDomainDNSName=contoso.com
ForestLevel=3
DomainNetbiosName=CONTOSO
DomainLevel=3
InstallDNS=Yes
ConfirmGc=Yes
CreateDNSDelegation=Yes
DNSDelegationUserName= contoso.com/administrator
DNSDelegationPassword=*
DatabasePath="C:/Windows/NTDS"
LogPath="C:/Windows/NTDS"
SYSVOLPath="C:/Windows/SYSVOL"
; Set SafeModeAdminPassword to the correct value prior to using the unattend file
SafeModeAdminPassword=
; Run-time flags (optional)
; RebootOnCompletion=Yes

  你会注意到上面的文件创建了新的域控制器(与复制DC完全相反)。DNS和NetBIOS的名字都设置在该文件里。ForestLevel和DomainLevel 的设置与Windows Server 2008的Forest Functional Level和Domain Functional Level一致。这里的2或1设置于Windows Server 2003和Windows Server 2000 Native Mode一致。这个脚本也配置成创建Global Catalog、DNS delegation和NTDS文件。

  确保在SafeModeAdminPassword行输入用于Directory Services Safe Mode的强劲密码。如果没有密码,运行脚本将显示一个对话框,需要你输入密码,防止脚本随意运行。

  下面是第二个例子。如果你需要添加第二个域控制器到现有域,可以使用下面的无人化安装脚本:

; DCPROMO unattend file (automatically generated by dcpromo)
;
; You may need to fill in password fields prior to using the unattend file.
; If you leave the values for "Password" and/or "DNSDelegationPassword"
; as "*", then you will be asked for credentials at runtime.
;
[DCInstall]
; Replica DC promotion
ReplicaOrNewDomain=Replica
ReplicaDomainDNSName=contoso.com
SiteName=Default-First-Site-Name
InstallDNS=Yes
ConfirmGc=Yes
CreateDNSDelegation=No
UserDomain=contoso.com
UserName=*
Password=*
DatabasePath="C:/Windows/NTDS"
LogPath="C:/Windows/NTDS"
SYSVOLPath="C:/Windows/SYSVOL"
; Set SafeModeAdminPassword to the correct value prior to using the unattend file
SafeModeAdminPassword=
; Run-time flags (optional)
; CriticalReplicationOnly=Yes
; RebootOnCompletion=Yes

  这个脚本在Default-First-Site-Name站点为contoso.com域创建了复制DC。这台服务器配有DNS和Global Catalog服务,以及跨网络复制Active Directory对象。由于SafeModeAdminPassword需要用户名和密码,不过这里也需要它们验证到域。输入正确的用户名和密码,验证到上面正确的领域。

  现在,我从哪里获得这些脚本?我需要手动输入脚本吗?不需要。在Windows Server 2008里,dcpromo向导的最后一屏已使用新按钮更新。这个新按钮是Export settings,使得上面生产脚本的过程非常简单。

  下面是自己创建脚本的速成方法:

首先,登录现有完整版本的Windows Server 2008实例,并运行dcpromo命令。
回答向导上面的问题,就如在候选Server Core DC上那样回答。
完成向导时,不要点击继续,点击Export settings按钮在无人化安装文件里保存设置。
将这个文件传到Server Core实例里,与dcpromo命令一起使用以运行DC安装。
  完成这一系列活动后,就可以轻松创建必要的无人化安装。Export settings按钮记录了每个必要配置到无人化安装文件。创建后,只需简单调整,就可以跨多个DC安装重新使用文件。