Friday, September 26, 2014

Commands to elevate Server Core 2008 to a Domain Controller

Ok, this post is going to be a lot more technical than previous posts. In fact I'm going to assume a few things, first you know what a Windows 2008 Server Core is. Second you know what a domain controller is, DHCP, DNS and server roles. If you didn't understand what any of that is, you won't know have much of a clue as to what the commands do. I also assume you are a domain or server admin. Since I'm assuming such things I won't go into detail about the commands. 

This came about as I was setting up a few server core installations at work. I had trouble finding all the commands I needed in one spot. Wording in red are the items that need to be specific to the server you are setting up, such as server name and IP address. I've highlighted the commands that need to be entered into the command prompt. All the commands are listed in order. 

Powershell

sconfig 
--This will bring up a blue PowerShell window where you can select different options such as Windows updates. Some of the commands listed below can be done using PowerShell. If you want to minimize using the command prompt this is a good option. It's up to you as it does the same thing. The process of promoting the server to a domain controller cannot be done using PowerShell.

To set the local user password
net user administrator *"

This will give you a prompt to set the password

To change the computer name
netdom renamecomputer %computername% /NewName:MyServerCore

To setup a static IP address and DNS server
netsh interface ipv4 set address name="Local Area Connection" source=static address=192.168.1.100 mask=255.255.255.0

netsh interface ipv4 add dnsserver name="Local Area Connection" address=192.168.1.1 (IP address of DNS server)

To join a domain
netdom join %computername% /domain:MyDomain /userd: MyDomain\MyLogin /passwordd:*

To setup the local time and set the timezone
control timedate.cpl

--This will launch the GUI found on other versions of Windows

To enable remote desktop /RDP
cscrip %windir%\system32\SCRegEdit.wsf /ar 0

Disabling Firewall
netsh advfirewall set allprofiles state off 
The following is the command line for promoting a Server Core 2008 R2 to a DC                 
Dcpromo.exe  /unattend /confirmGC: yes /DatabasePath:”c:\Windows\NTDS” /logpath:”c:\ntdslog s” /sysvolpath:”C:\sysvol” /SafemodeAdminPassword:Password /ReplicaOrNewDomain:replica /Userdomain:domain /Username:admin name /Password:admin password /ReplicaDomainDNSName: domain FQDN /rebootoncompletion:yes

This link will show all the available DC promo commands. http://technet.microsoft.com/en-us/library/cc732887(v=ws.10).aspx I haven’t found it necessary to use more than the command switches above.

To add different roles to the server use one of the following commands
--For DNS
                Start /w ocsetup DNS-Server-Core-Role


--For DHCP
                start /w ocsetup DHCPServerCore
                sc config dhcpserver start= auto
                net start dhcpserver

--DNS and DHCP are best configured using the MMC snap in from a Windows 7 desktop connected to the server.

--For print services role
                start /w ocsetup Printing-ServerCore-Role
                start /w ocsetup Printing-LPDPrintService

Printers can be added and configured using the Print Management snap in from your Windows 7 desktop.
  1. Determine the IP address or host name of the printer. This may be on the printer's test or printer configuration page or you might need to refer to the manufacturer's documentation for instructions.
  2. Verify that the print server can communicate with the printer through the network by pinging the printer from the print server.
  3. On another computer running Windows 7 or Windows Server 2008, open the Print Management console and add the server running the Server Core installation.
  4. Expand the entry for the print server running a Server Core installation, right-click Drivers, and then click Add Driver. The Add Printer Driver Wizard starts
  5. Complete the wizard to install the printer driver for your printer.
  6. In the Print Management console, right-click Printers and then click Add Printer. The Network Printer Installation Wizard starts.
  7. Click Add a TCP/IP or Web Services printer by IP address or hostname and then click Next.
  8. Enter the printer's host name or IP address (the port name will be the same by default), and then click Next.
  9. Make any necessary changes to the printer name, contact information, or sharing status, and then click Next.


To add the Active Directory Lightweight Directory Services role
            start /w ocsetup DirectoryServices-ADAM-ServerCore

AD is also best configured using the MMC snap in from a Windows 7 desktop connected to the server.

Demoting a Server Core domain controller 
I had trouble with domain replication for one of our branch servers. When I tried to force replication it kept getting an error and of course it wouldn't do it on it's own. The best solution seemed to be to demote it as a DC and re-promote it. The commands to do that seemed difficult to find, so I added them to this post.

dcpromo /unattend /forceremoval /demotefsmo:yes /username:<domain admin> /userdomain:<domain> /password:<DA password> /administratorpassword:<local admin password>

dcpromo /unattend /uninstallbinaries

Then just re-run the commands to promote it to a DC. If you use the command below to dis-join it from a domain, you'll need to re-join it to a domain before promoting it.

Remove server from a Domain
netdom remove /d:%USERDOMAIN% %COMPUTERNAME%


No comments:

Post a Comment