Windows Server 2012 R2 active directory lab feat. powershell

This post is demonstrating the required powershell commands to install and configure Windows Server 2012 R2 (including “core”) with active directory domain services.
It is more of a reference to quickly install a domain server in your lab and furthermore the first of a few loosely coupled posts to install and test a nfs4 environment with EMC Isilon.

The first thing we have to do is to get a copy of Windows Server 2012 R2 from the Microsoft Evaluation Center and install it in your lab. You can either install the full version or just “core”, which does not offer a full GUI.

Windows Server 2012 core with its powershell support gets closer to the linux philosophy, to only install the services you really need. You now even have the capability to install or uninstall the GUI later. Isn’t that nice? But reboots are still required. 😉

Personally I would start using “core” more often as you don’t have to install all the internet explorer patches…

After the successfully installation lets fire up a powershell and do the basic configuration:

# rename computer
Rename-Computer -NewName dc1

# get Network Interface ID
Get-NetIPInterface -AddressFamily IPv4 -InterfaceAlias Ethernet*

# in my case the interface index is "12"
New-NetIPAddress –InterfaceIndex 12 –IPAddress –PrefixLength 24 –DefaultGateway

# set dns server address, this IP will later also automatically used as a dnsforwarder
Set-DNSClientServerAddress –InterfaceIndex 12 -ServerAddresses

At this point we should have a proper named host with a functional network environment. Next we install and configure our active directory domain services:

# install AD Domain Services
Install-WindowsFeature ad-domain-services -Includemanagementtools -Restart

# in my case the domain will be named "emc.lab"
Install-ADDSForest -DomainName emc.lab

# create reverse lookup zone
Add-DnsServerPrimaryZone -NetworkID "" -ReplicationScope "Forest"

With only 8 powershell commands (and a few reboots…) you have configured your Windows Server 2012 R2 lab server!

If you like powershell or installed the “core” version and don’t want to configure a second host with the remote server administration tools here are some useful powershell commands:

# create A Record for client1
Add-DnsServerResourceRecordA -ZoneName emc.lab -CreatePtr -Name client1 -IPv4Address

# create a group
New-ADGroup -name test_user

# create a user 'user1' with password "Passw0rd"
New-ADUser -name user1 -PasswordNeverExpires:$true -AccountPassword (ConvertTo-SecureString "Passw0rd" -AsPlainText -Force) -Enabled:$true

# add user to our group
Add-ADGroupMember -Identity test_user -Members user1

And here you can find the full powershell 4.0 documentation for reference.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.