Installing Windows and Active Directory with an Answer File
If you are anything like me, installing Windows is one of your pain points. It is not that I don’t know how to install Windows, it’s the fact that it does take some time and babysitting. About a year ago I started using answer files to install my production servers. This allowed me to configure the server the way I want to so that I can get the same exact configuration after install every time. In my previous posts, I wrote about automating domain controller installation using a unattend.txt file. Now doing that is all nice and good after you have installed the OS, but what if you want to take care of it all in one quick swoop. This is where adding the active directory information to the unattend.txt file comes in handy.
Getting StartedTo get started you need a couple of things. First you need your Windows installation media. On the CD you can find a Support directory under the root of the drive. In the support directory there is a folder called tools. When I create a new answer file, I always extract the contents of the deploy.cab file to my working area. In that cab file you will find a ref.chm file that contains all of the available switches for unattend.txt, sysprep.inf, and some OEM files to help you automate deployment. Today we are only interested in the ref.chm file. Other things you will need is a blank text file, and optionally a floppy disk.
Using Setup Manager to Create a Basic Unattend.txt FileOne of the easiest ways I found to create a basic unattend.txt file is to use the Setup Manager application that is included in the deploy.cab file on your installation media. Using Setup Manager you answer questions that you would normally see during Windows installation. To create a basic unattend.txt file using Setup Manager for this article I selected the following items when it came up:
1. Create New (On New or Existing Answer File Page)
2. Unattended Setup (On Type of Setup Page)
3. Windows Server 2003, Enterprise Edition (On Product Page)
4. Hidden Pages (On User Interaction Page)
a. I select that so I can enter the information and walk away and not worry about end users seeing the information I have used.
5. Setup from CD (On Distribution Share Page)
Once all this information is selected, Setup Manager asks you for information needed to setup Windows. The following is the answer file that Setup Manager provided once done using the utility.
;SetupMgrTag
[Data]
AutoPartition=1
MsDosInitiated="0"
UnattendedInstall="Yes"
[Unattended]
UnattendMode=DefaultHide
OemPreinstall=No
TargetPath=\WINDOWS
[GuiUnattended]
AdminPassword=*
EncryptedAdminPassword=NO
OEMSkipRegional=1
TimeZone=35
[UserData]
ProductKey=11111-11111-11111-11111-11111
FullName="Matt Johnson"
OrgName="MWJ Computing"
ComputerName=MTEST1
[Display]
BitsPerPel=32
Xresolution=1024
YResolution=768
[LicenseFilePrintData]
AutoMode=PerServer
AutoUsers=5
[TapiLocation]
AreaCode=734
[Identification]
JoinDomain=MWJCOM1
DomainAdmin=addMachine
DomainAdminPassword=password
[Networking]
InstallDefaultComponents=No
[Branding]
BrandIEUsingUnattended=Yes
[Proxy]
Proxy_Enable=0
Use_Same_Proxy=0
[NetAdapters]
Adapter1=params.Adapter1
[NetClients]
MS_MSClient=params.MS_MSClient
[NetServices]
MS_SERVER=params.MS_SERVER
[NetProtocols]
MS_TCPIP=params.MS_TCPIP
[params.MS_TCPIP]
DNS=No
UseDomainNameDevolution=No
EnableLMHosts=Yes
AdapterSections=params.MS_TCPIP.Adapter1
[params.MS_TCPIP.Adapter1]
SpecificTo=Adapter1
DHCP=No
IPAddress=10.0.0.15
SubnetMask=255.255.0.0
DefaultGateway=10.0.0.1
DNSServerSearchOrder=10.0.0.15
WINS=No
NetBIOSOptions=0Once this file is created, now you can start editing this to add other options you might need, like IIS, as well as your domain controller information.
Adding Domain Controller Promotion InformationUsing the unattend.txt file that you created above, you can now add the [DCInstall] options to the file. Once you have added the section for [DCInstall] you will see something like the following in your unattend.txt file.
;SetupMgrTag
[Data]
AutoPartition=1
MsDosInitiated="0"
UnattendedInstall="Yes"
[Unattended]
UnattendMode=DefaultHide
OemPreinstall=No
TargetPath=\WINDOWS
[GuiUnattended]
AdminPassword=*
EncryptedAdminPassword=NO
OEMSkipRegional=1
TimeZone=35
[UserData]
ProductKey=11111-11111-11111-11111-11111
FullName="Matt Johnson"
OrgName="MWJ Computing"
ComputerName=MTEST1
[Display]
BitsPerPel=32
Xresolution=1024
YResolution=768
[LicenseFilePrintData]
AutoMode=PerServer
AutoUsers=5
[TapiLocation]
AreaCode=734
[Identification]
JoinDomain=MWJCOM1
DomainAdmin=addMachine
DomainAdminPassword=adding
[Networking]
InstallDefaultComponents=No
[Branding]
BrandIEUsingUnattended=Yes
[Proxy]
Proxy_Enable=0
Use_Same_Proxy=0
[NetAdapters]
Adapter1=params.Adapter1
[NetClients]
MS_MSClient=params.MS_MSClient
[NetServices]
MS_SERVER=params.MS_SERVER
[NetProtocols]
MS_TCPIP=params.MS_TCPIP
[params.MS_TCPIP]
DNS=No
UseDomainNameDevolution=No
EnableLMHosts=Yes
AdapterSections=params.MS_TCPIP.Adapter1
[params.MS_TCPIP.Adapter1]
SpecificTo=Adapter1
DHCP=No
IPAddress=10.0.0.15
SubnetMask=255.255.0.0
DefaultGateway=10.0.0.1
DNSServerSearchOrder=10.0.0.15
WINS=No
NetBIOSOptions=0
[DCInstall]
AdministratorPassword = domainpassword
AllowAnonymousAccess = No
AutoConfigDNS = Yes
ConfirmGC = Yes
CreateOrJoin = Join
DatabaseParth = %SYSTEMROOT%\NTDS
DNSOnNetwork = Yes
DomainNetBiosName = MWJTEST1
LogPath = %SYSTEMROOT%\NTDS
RebootOnSuccess = Yes
ReplicaOrNewDomain = Domain
SafeModeAdminPassword = domainpassword
SiteName = Southgate
SysVolPath = %SYSTEMROOT%\Sysvol
UserDomain = MWJCOM1.LOCAL
UserName = administratorFollowing Up with Your unattend.txt fileWhen using this file, don’t forget to change the machine name in the [UserData] section of your answer file for each subsequent machines created using this answer file. (Like I even have to tell you that, but hey it has happened to the best of us.) Also be sure to keep this file in a place that only authorized administrators have access to the file as this file holds the keys to the kingdom as well as those valuable product keys used during installation.
You can do some pretty cool things with unattend.txt files so that your life becomes easier. I encourage you to browse the ref.chm file and the deploy.chm file located in the deploy.cab file on your Windows CD.