Quantcast
Viewing latest article 7
Browse Latest Browse All 9

Windows Server 2012: Setting up a Domain Controller with PowerShell

Image may be NSFW.
Clik here to view.
Windows-Server-2012-Logo1

The new advancements in Windows Server 2012 are very vast, in other articles here on DIYITShop, we have outlined some of these changes, with more articles to come. We have begun to test many aspects of the new server operating system in depth, but primarily the first thing you need to do is create server and make it a domain controller.

Generally making a server a domain controller in the past was pretty easy. Install the operating system, then execute “dcpromo” from the command line, and this would execute installing the Active Directory Domain Services roles on the server. Microsoft has thrown you a curve ball now, and deprecated the “dcpromo” command.  Microsoft has still provided multiple tools, to make your server a domain controller either through PowerShell, or through the new Server Manager Promotion wizard.

We will discuss the method of installing a domain controller via PowerShell.

1.) Install Server 2012 Core and PowerShell only. Once you have finished installing and configuring your new password in the CMD prompt type:

C:\powershell
PS C:\

2.) Lower your execution policy:

PS C:\Set-ExecutionPolicy remotesigned

3.) Set Computer Name and restart:

PS C:\Rename-Computer -NewName "DC1" -Restart

4.) Check your Interface number, in this case only 1 NIC assigned, but the rest of the configuration uses the interface number listed.

PS C:\Get-NetAdapter -Physical

5.) Rename the NIC:

PS C:\Get-NetAdapter -InterfaceIndex 12 | Rename-NetAdapter -NewName "Local"

6.) Set your IPv4 Address to the interface:

New-NetIPAddress -IPAddress 192.168.1.2 -DefaultGateway 192.168.1.1 -PrefixLength 24 -InterfaceIndex 12

7.) Set your DNS Server:

PS C:\Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses 127.0.0.1

8.) Configure DNS Client settings:

PS C:\Set-DNSClient -InterfaceIndex 12 -ConnectionSpecificSuffix “lab.local” -RegisterThisConnectionsAddress $true -UseSuffixWhenRegistering $true

9.) Disable LMHOST

PS C:\Invoke-CimMethod -ClassName Win32_NetworkAdapterConfiguration -MethodName EnableWINS -Arguments @{DNSEnabledForWINSResolution = $false; WINSEnableLMHostsLookup = $false}

10.) Disable NETBIOS over TCP/IP

PS C:\Get-CimInstance win32_networkadapterconfiguration -Filter ‘servicename = “netvsc”‘ | Invoke-CimMethod -MethodName settcpipnetbios -Arguments @{TcpipNetbiosOptions = 2}

11.) Rename file system volume:

PS C:\Set-volume -driveletter c -newfilesystemlabel System

12.) Assign Drive Letter Z to DVD Drive:

PS C:\Get-CimInstance Win32_Volume -Filter ‘drivetype = 5′ | Set-CimInstance -Arguments @{driveletter = “Z:”}

13.) Add binaries for Active Directory:

PS C:\New-item c:\installdvd -ItemType directory

14.) Which Edition of Windows am I running?

PS C:\Get-WindowsEdition -Online

15.) Select the correct image index from the source file on the DVD

PS C:\Get-WindowsImage -ImagePath z:\sources\install.wim

16.) Mount the Image:

PS C:\Mount-windowsimage -imagepath z:\sources\install.wim -index 3 -path c:\installdvd -readonly
 install-windowsfeature AD-Domain-Services,DNS -IncludeManagementTools -Source C:\installdvd\Windows\WinSxS dismount-windowsimage -path c:\installdvd -discard

17.) Get Safe Mode Admin password:

PS C:\$safemodeadminpwd = read-host “Safe mode admin Password:” -AsSecureString

18.) Install Active Directory

Install-ADDSForest -DomainName “lab.local” -DomainNetbiosName “lab.local” -DomainMode Win2008R2 -ForestMode Win2008R2 -InstallDns -SafeModeAdministratorPassword $safemodeadminpwd -Force

19.) Add the Default First Site Name

PS C:\Get-ADReplicationSite | Rename-ADObject -NewName “lab.local"

20.) Add the Subnet to the Local Site

PS C:\New-ADReplicationSubnet -Name “192.168.1.0/24″ -Site lab.local>

21.) Enable Recycle Bin:

PS C:\Enable-ADOptionalFeature “Recycle Bin Feature” -Scope Forest -Target lab.local -confirm:$false

22.) Configure DNS Server Forwarder for the Internet:

PS C:\Set-DnsServerForwarder -IPAddress 192.168.1.1

23.) Enable RDP:

PS C:\get-CimInstance “Win32_TerminalServiceSetting” -Namespace root\cimv2\terminalservices | Invoke-CimMethod -MethodName setallowtsconnections -Arguments @{AllowTSConnections = 1; ModifyFirewallException = 1}

24.) Set RDP to only accept Network Level Authentication:

PS C:\get-CimInstance “Win32_TSGeneralSetting” -Namespace root\cimv2\terminalservices -Filter ‘TerminalName = “RDP-Tcp”‘ | Invoke-CimMethod -MethodName SetUserAuthenticationRequired -Arguments @{UserAuthenticationRequired = 1}

After following these steps you should have a Server 2012 Core Domain Controller on your hands. If you have any questions feel free to leave comments.


Viewing latest article 7
Browse Latest Browse All 9

Trending Articles