Showing posts with label Powershell V3. Show all posts
Showing posts with label Powershell V3. Show all posts

Tuesday, January 27, 2015

PowerShell : 3 Cool tips to learn PowerShell.

 

6:30 am in the morning and my phone starts ringing……

I picked up the phone and I heard the familiar voice, it is  “A Murky Ana!”

A Murky Ana : “Are you sleeping?”

Me : “Nope, was playing soccer, at 6:30 am. Come On! what peoples does at 6:30 am in the morning? They do sleep.”

A Murky Ana: “OOps, sorry to wake you up, I have a question.”

Me: “What!!!! Can’t you ask a question after 4 hours, so that I can complete my sleep ( yawning) ”

A Murky Ana: “No! answer me now!”

Me : “{… thinking.. W.T.Heck} ,  OK, give me 3 minutes, let me make Coffee first? Can I hung up the phone can call you back?

A Murky Ana: “No! I can hold “

Me : “OK, OK”

I started making coffee and after that we started the conversation again…

Me: “Ok, what is your question?”

A Murky Ana:After talking with you week before ,  I am interested in Learning PowerShell, I want to know the tips to learn PowerShell”

Me : “Ok, Pick a Pen and write  down the tricks which i am sharing with you now.”

A Murky Ana: “ Done”

Me : “ I am giving you 3 cool tips to learn PowerShell easily and quickly”

Tip 1 :  “Start using PowerShell Console, rather than “CMD”

 

You can run the native windows command on “PowerShell Console” too, PowerShell console do support most of the in-built native command, So start using the PowerShell console to get familiar with it, to know more about it’s look and feel. Stop using the CMD. You can do the same thing which you do on cmd, it's time to replace CMD with PoweShell console.

 

27-01-2015 18-27-44

TIP 2 : “Start using PowerShell Cmdlets rather than “native commands”

 

The more you use PowerShell cmdlets and the more you learn PowerShell. You can start using some basic PowerShell cmdlets and stop using the native ones. For example start using Test-Connection rather than using Ping.exe to below is the list of few command which you can use rather then the native ones.

 

Replace

With PowerShell Cmdlet

Ping

Test-Connection

Dir

Get-Childitem

Mkdir

New-Item

Cat

Get-Content

Tasklist.exe

Get-Process

Shutdown /r

Restart-Computer

net start

Start-Service

net stop

Stop-Service

 

 

 

Tip 3: “Make a new friend “Get-Help”

 

Start learning about PowerShell, the best way to learn is to start reading the ABOUT files. They have contain information about most of the PowerShell features and techniques.  Read a About file in a day and that make your PowerShell learning easy and fast.

PS C:\> Get-Help *about*

27-01-2015 19-07-59

A Murky Ana: “That’s Cool. Ok I give a try and let you know, Bye!!!!!!!”

She hung up the phone……………………………..

 

* All characters appearing in this work are fictitious (Apart from ME and the Author of the books and the online reference on the blogs). Any resemblance to real persons, living or dead, is purely coincidental.

 

Regards.

Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

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