Showing posts with label windows Server 8. Show all posts
Showing posts with label windows Server 8. Show all posts

Monday, February 10, 2014

Part-4 PowerShell and DHCP: Setting DHCP server’s “Server Options”

 

 

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

Part – 2 :PowerShell and DHCP : DHCP Post-Install Configuration

Part – 3 :PowerShell and DHCP :  Configuring the DHCP Scope

 

In my previous post on “DHCP” article series, we had configure the “DHCP Scope” for DHCP server. Now it is time to set the “Sever Options” for the DHCP server.  

We are going to set the below server options.

S.No

OptionID

Description

1

6

DNS Server

2

3

 Gateway Address

3

15

DNS Suffix

 

Setting Server Options

We have to use the “Set-DhcpServerv4OptionValue” cmdlet to set server options for the DHCP Server. In this cmdlet we have to use the “OptionID” and it’s “Value” parameters mainly.

Open DHCP manager from tools and you can see that there is no “Server Options” are configured yet.

clip_image002

 

Run, “ipconfig /all on client machine and you can see, there is NO entries for, Gateway, Connection specific DNS Suffix and DNS Server ..

clip_image004

 

Setting DNS Server

Let’s set the DNS Server option first, the OptionID for DNS server is 6 ,  I am setting , 202.56.215.55  as a DNS Server.

Set-DhcpServerv4OptionValue -OptionId 6 -Value 202.56.215.55

clip_image006

 

You can also set multiple DNS server by providing multiple comma separated values.

Set-DhcpServerv4OptionValue -OptionId 6 -Value 202.56.215.55 , 202.56.215.54 , 8.8.8.8

clip_image008

 

Setting Gateway

The option ID for gateway is 3, I am setting the value 192.168.1.99 as a gateway address.

Set-DhcpServerv4OptionValue -OptionId 3 -Value 192.168.1.66

clip_image009

 

Setting DNS Suffix

The OptionID for DNS Suffix is 15

I am setting my website domain name a DNS suffix.

clip_image010

 

DHCP Manager

Now open DHCP server manager and click on “Server Options” and you will see all of our entries which we configured and set by PowerShell are there.

clip_image012

 

Testing

It’s time to test the configuration, Now, do the following on your client machine

1.       Run “Ipconfig /release

2.       Run “Ipconfig /renew

3.       Run “Ipconfig /all

Here you go, you can see all of our configured setting there.

clip_image014

 

That’s all for now. See you in my next blog article.

 

Regards

Aman Dhally

clip_image017 clip_image018 clip_image019 clip_image020  clip_image021

Monday, January 20, 2014

Part–3 : PowerShell and DHCP : Configuring the DHCP Scope DHCP Server

 

 

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

Part – 2 :PowerShell and DHCP : DHCP Post-Install Configuration

 

 

In my previous post, we do the Post-Install configuration task for the DHCP Server.  Now it’s time to configure the DHCP Sever Scope. We can going to do the below configuration.

Configuration.

 

DHCP Configuration

Name

ID

 

 

IP Address Scope

 

192.168.1.100

192.168.1.200

DNS Server

6

 

 

Gateway

3

192.168.1.99

 

Domain Name

15

Amandhally.net

 

Subnet Mask

 

255.255.255.0

 

 

We configure our DHCP server to give us the automatic IP Address from Range 192.168.1.100 to 192.168.1.200.  Subnet mask  is “255.255.255.0” our Gateway’s IP Address is 192.168.1.99 and the IP Address of our DNS Server is “192.168.1.99”, and as a domain name for DHCP IP, I am using amandhally.net.

Scope

 

Before setting scopes, I want to bind the specific LAN card for DHCP Server ( as I have 2 LAN cards on my server), I don’t want to run DHCP server service on all of My LAN Cards,  to do that, I can use “Set-DhcpServerv4Binding” cmdlet.

You can see I have 2 Ethernet cards on my machine, and I want to run the DHCP server on the LAN card named as “for_dhcp”.  

Note: I renamed this LAN card manually, from “Local Area Network” to “for_dhcp”.

Now run the below command.

Set-DhcpServerv4Binding -InterfaceAlias "for_dhcp" -BindingState $true

clip_image002

 

Once it done, let cross check it by running the Get-DhcpServerv4Binding cmdlet.

 

clip_image004

Perfect, the Ethernet is bind.

 

Setting Scope.

 

Now, we have to set a scope for the DHCP Server, so that he can start giving us the IP addresses.

$nameScope = 'DHCP Delhi'

$startIP = '192.168.1.100'

$endIP = '192.168.1.200'

$subnetMask = '255.255.255.0'

For my ease, I set my settings is variable, so that is easy to change later on {idea for scripting } , and save them as a script file for later use.

Above, I am setting the name of the scope to “DHCP Delhi” and the DHCP server start leasing the IP Address from “192.168.1.100” to end IP address of “192.168.1.200”. and my subnet mask will be “255.255.255.0”.

We have to set all of above using the “Add-DhcpServerv4Scope” cmdlet.

Now, Once you set the variable, run the below command. By using –State parameter to True, we are making this scope active.

Add-DhcpServerv4Scope -Name $nameScope -StartRange $startIP -EndRange $endIP -SubnetMask $subnetMask -State Active

Or

Add-DhcpServerv4Scope -Name 'DHCP Delhi'-StartRange '192.168.1.100' -EndRange $'192.168.1.200' -SubnetMask '255.255.255.0'-State Active

 

clip_image006

Once the above command run successfully, open your DHCP Server Manager and you can see that we have a new scope and that scope it Active.

clip_image008

 

Even our DHCP Sever is started giving the address to other laptop on the network too.

clip_image010

 

And I run Ipconfig /release and then Ipconfig /renew on another laptop and he gets the IP address from our server too.

clip_image012

 

Now, when you open the console, you can see our DHCP Server has given 2 ips to the computers.

Great J Isnt’

clip_image014

 

Till, now , we are successfully able to get the IP address on client system from our DHCP Server, But we won’t able to connect to Internet or other services, until we configure the Router and DNS options in the DHCP Server,

In our next blog post we are going to do that.

See you in my next blog post.

 

 

Regards
Aman Dhally
 
clip_image017 clip_image018 clip_image019 clip_image020  clip_image021

Thursday, January 3, 2013

Installing Windows Features using Powershell V3

Hi,

While working on Powershell V3 i have realised that Scripting are going to be easy. Scripters just need to add bunch of cmdlets to the scripts and done. In Powershell V3 Microsoft had make CMDLET for almost everything or for every task.

The main task which SYSADMINS do this installing extra windows features in to the server or to the desktops. These features may be setup a server a DHCP,DNS,FAX or a simple feature like installing or enabling XPS viewer.

I am using a fresh installation of “Windows Server 2012 Standard Edition with GUI” and i do often view and read “XPS formatted  Documents”. BY Default the XPS file viewer is not installed on “Windows server 2012”. 

So i think why not install it using the Powershell V3 cmdlet. 

To get the list of all available/installed windows feature we can use the cmdlet

“Get-WindowsFeature”

The features those have [x] in the from of them means that they are installed.  When you query any single feature using  “Get-WindowsFeature” cmdlet then provide the NAME of the feature not the “Display Name”

03-01-2013 12-07-44

Let’s see if the “XPS Viewer” is installed or not.

Get-WindowsFeature -Name “XPS-Viewer”

You can see that XPS-Viewer is available but it is not installed.
03-01-2013 12-08-46

To install Windows features we have to use the cmdlet “Install-WindowsFeature

Let’ install XPS-Viewer, run the below command line.

Install-WindowsFeature -Name “XPS-Viewer”

You can see it start Installing.

03-01-2013 12-10-05

When installation is done it shows the below screen, that installation is “Successful” and Reboot is “Not required” .

03-01-2013 12-11-47
let’s query the “XPS-Viewer” again using Get-WindowsFeature

Get-WindowsFeature -Name “XPS-Viewer”

and now we can see a [x] in the front of Display Name and the Install State in “Installed”

03-01-2013 12-12-12

and we can see XPS Viewer on our Desktop too.

03-01-2013 12-13-25

Nice Smile isn’t.

Thanks

Aman Dhally

 

clip_image001 clip_image002 clip_image003 clip_image005 clip_image007