Managing Windows Server 2012 R2 Using PowerShell

MANAGING WINDOWS SERVER 2012 R2 USING POWERSHELL

BSc., MCSEx2, MCSAx2, MCP, MCTS, CCNA, MCITP

In this lab I will guide you through the basic process of preparing a Window Server 2012 R2 computer to be a Domain Controller. This article assumes that you have successfully install the OS.

 

First, on the server, launch PowerShell as Administrator. Use the following commands for management

 

Renaming the server

 

Rename-computer “DCDEMO”

Restart-computer

 

 

Changing Timezone / Time

 

Tzutil /g (this will show the current time zone)

 

 

Tzutil /l (list all available time zones)

 

 

Tzutil /s “Eastern Standard Time” (set the time zone to EST)

 

 

Set-Date “7:00:00 PM” (Set the time to 7PM)

 

Changing IP Address

Netsh interface? (shows all command options related to netsh interface)

 

 

Netsh interface show interface

 

Note that the interface name is “Ethernet

 

 

Netsh interface ip set address “Ethernet” static 10.0.0.49 255.255.255.0 10.0.0.1 (set the interface with static IP address of 10.0.0.49, subnet mask of 255.255.255.0 and default gateway of 10.0.0.1).

 

 

Set the DNS:

 

Netsh interface ip add dns “Ethernet” 10.0.0.49 (set the DNS server to be this server itself)

 

Note that the output says that DNS server is incorrect. That’s OK because at this point, our server is not itself a DNS server. We will configure this box to be a DNS server later.

 

 

Add a second DNS Server

 

Netsh interface ip add dns “Ethernet” 8.8.8.8 index=2

 

Installing ADDS

Install-WindowsFeature AD-Domain-Services –IncludeManagementTools

 


 

Import-module ADDSDeployment

 


 

Install-ADDSForest –DomainName “Demo.Local” –DomainMode Win2012 –ForestMode Win2012 –InstallDNS –force

 


 


 

When installation is completed, the computer will be restarted automatically.

 


 

When the computer comes back up, log in as DEMO\Administrator.

 


 

Click Start, Administrative Tools to verify that you have all the Active Directory shortcuts as well as the DNS shortcut. This means your DC is ready.

 


 

Also, launch dnsmgmt.msc to verify that all DNS zones/records are properly configured.

 


 

Additionally, launch dsa.msc to verify Active Directory Users and Computers are configured properly.

 


 

 

Add a CNAME record in DNS

Dnscmd DCDEMO /recordadd Demo.Local Test2 CNAME www.google.com

Now if we ping test2.demo.local, it actually ping www.google.com because test2 is an alias of www.google.com.

 

Joining a client computer to the Domain

Add-computer –domain demo.local –credential “DEMO\Administrator”

Restart-computer

 

That’s it!