Showing posts with label Get-WindowsFeature. Show all posts
Showing posts with label Get-WindowsFeature. Show all posts

Friday, June 26, 2015

Managing Windows Server 2012 R2 Using PowerShell : Part-9 : Installing Windows Features.

 

  1. Part 1 : Windows Server 2012 R2 Installation.
  2. Part 2 : Exploring PowerShell Default Settings.
  3. Part 3 : Getting and setting server name.
  4. Part 4 : Getting IP Address of the server.
  5. Part 5 : Setting IP Address of the server.
  6. Part 6 : Checking if Server is member of domain.
  7. Part 7 : Joining Server to the domain.
  8. Part 8 : Magic of PowerShell PSRemoting..

6-24-2015 12-42-00 PM

Part - 9 : Installing Windows Features.

In the previous post we see the magic of Windows PowerShell PSRemoting. We have learned how to use it.

In this blog post, we are going to add a new windows feature by doing a PSRemoting to our remote server, or you can say that, by sitting on our own laptop, listening to the music, and we are going to configure our server remotely.

Cool ! No?

To  see the list of all available feature and roles available , which  we can deploy on our server we uses the Get-WindowsFeature cmdlet.

In the below screenshot, you can see, that I have PSRemoted to our Windows 2012 R2 Server. When we run the Get-WindowsFeature cmdlet, it has returned the list of all windows features.

1

So, how do you know, which feature is install or not?

We can check it by :

  • If the feature is already installed, then it's "Install State" is Installed, otherwise it's "Install State" is Available.
  • You can see a cross [X] in the front of installed features. and empty [  ] in the front of the feature/role which is available to install but not installed yet.

Picture1

If you want to know about any specific feature thatif it is installed or not, then user Get-WindowsFeature  and then provide the name of the feature in -Name parameter.

For example ,after run the below command you can see  that 'Management Tools' are not installed on this server.

Get-WindowsFeature -Name 'Web-Mgmt-Tools'

6

To install any feature or role, we use the Install-WindowsFeature cmdlet.

The usage of cmdlet is very simple. Type cmdlet and then provide the name of feature to install.

Let's try installing XPS Viewer. The below command is very simple and not need to

 

Install-WindowsFeature XPS-Viewer

3

In the below screenshot, we can see, that our feature install successfully.

5

That's all for now, see you in my next blog post.

Aman Dhally, Manya Kaur

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”.

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

 

 

 

 

 

 

 

Monday, January 7, 2013

Uninstalling Windows Features using Powershell V3

Hi,

In my previous post i posted about on “How to install windows features” using powershell v3. Today i am about to post about how to un-install them.

The un-installation of windows features using powershell quite easy as installing them.

Let’s start.

Lets check if we still have “XPS-Viewer” installed as feature on our windows 8 server machine.,

Get-WindowsFeature -Name "XPS-Viewer"

So XPS-Viewer is still installed.

07-01-2013 15-53-30

Now lets uninstall it using the cmdlet “Uninstall-WindowsFeature”

run  Uninstall-WindowsFeature” with -Name parameter and provide the name of the windows feature which you want to uninstall.

Uninstall-WindowsFeature -Name "XPS-Viewer"

 

07-01-2013 15-54-44

Now it start removing “XPC-Viewer”

07-01-2013 15-54-57

one all done this will show the success windows. you can see in the command line output the value of Success is True.

07-01-2013 15-56-13

to cross check the un-installation lets run  Get-WindowsFeature -Name "XPS-Viewer" again.

and the you can see there is no [x] boxed in the front of the “XPS Viewer” and the install state is available.

07-01-2013 15-56-31

Thanks

Aman Dhally

 

clip_image001 clip_image002 clip_image003 clip_image005 clip_image007