Thursday, January 9, 2014

Part – 1 : PowerShell and DHCP : Installing DHCP Server Role on Server 2012

New PowerShell Series

After publishing my “Event Logs and PowerShell” series, I am posting another PowerShell article series, this article series is on installing, configuring, maintain DHCP Server using PowerShell.

In this series, we will configure a DHCP Server from scratch and we configure it using PowerShell. We will try to use as much as PowerShell as we can.

Side by side, we also try to generate a small simple script, those are help us to automate the whole deployment.

Background

If you are a system administrator like me, our main job is to configuring and deploying servers with different or same server roles.

Sometime with a different configurations and sometime with exactly the same configuration of another servers.

 For example if you are about to deploy a DHCP Server in any of your regional office or local office, I am sure that most of the settings will remain same like other DHCP servers.

Rather than doing the same thing manually again and again, we will use PowerShell to automate it, in this series, I will start configuring DHCP sever from the PowerShell console, but in the end we will try to write a small script to automate the whole manual task.

Specification

I am going to use Windows Server 2012 as a DHCP Server, and a windows 7 as client system, both are the virtual machine those are running on windows Hyper-V.

Configuration

Our DHCP Server configuration should be simple. The below is the list of task which we are going to do.

1.       Install the DHCP role on Server 2012

2.       Configure

a.       DHCP Scope

b.      Authorise Server

c.       Configure DNS Option

d.      Configure Router Option

e.      Configure DNS Domain Name option

f.        See if we manage to set Reservation

3.       Start DHCP Server

4.       Test it

May be we added more task, if needed arise.

Note

Before installing the DHCP serve role, make sure your would be DHCP server has STATIC IP Address, otherwise you will get the below warning error while installing the DHCP server role.

clip_image002[5]

Installing DHCP Role

 

Our first step is to install the DHCP role, but before installing the serve role, we have to check  if the role is already installed or not.

We can use Get-WindowsFeature cmdlet to check which role are currently Installed, or Available to install or Removed.

clip_image003

 

We are interested in installing, the DHCP server role.  You can see that DHCP Role is available but not installed.

clip_image005

 

Now using let’s check for DHCP Server Role Only, you can see in the below output that the DHCP role is available but it is  not installed.

Get-WindowsFeature -Name 'DHCP'

clip_image007

 

Now, let’s install DHCP Server Role, by using the cmdlet “Install-WindowsFeature”.  And in             –Name  parameter, we have to provide the Name of server role as argument , which role we want to install, in our case it is “DHCP”.

Install-WindowsFeature -Name 'DHCP' –IncludeManagementTools

 

clip_image009

 

clip_image010[5]

 

Once the command run successfully. You can see that the EXIT code is showing Success and value of success is True. That means DHCP Server role in installed successfully.

clip_image012[5]

Let’s run Get-WindowsFeature -Name 'DHCP'again to verify if role is installed or not.

Now you can check that install State of server role in installed now.

clip_image014[5]

 

Now, when you open server manager, and in Roles and features you can see a DHCP Server role is there, and you can see in that You have a new DHCP option available underneath all Servers option.

 

clip_image016[5]

 

And when you click on them, you can see all things related to DHCP.

 

clip_image018[5]

 

When you click on Tools, you can see the DHCP , option there.

clip_image020[4]

 

And when you click on it DHCP manager will open.

clip_image022[4]

 

 

That’s all for today, see you in the next post.

 

 

Regards
Aman Dhally
clip_image017 clip_image018 clip_image019 clip_image020  clip_image021

 

 

 

 

 

 

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.