List Windows Server Roles and Features with PowerShell

I’m sure for anyone who administers Microsoft Windows Server the Server Manager console is an all too familiar place. It does make it easy to add/remove roles and features however PowerShell is another great option that can really speed things up at times.

So – what can we do with PowerShell to list the roles and features on our Windows servers?

List Roles and Features

First let us look at how we can display a list of the roles and features on our server with PowerShell. The command we need is get-windowsfeature which will give us an output such as this –

get-windowsfeature

get-windowsfeature

This is a nice start however if you try the command yourself you will see that it scrolls down the screen listing every single role and feature along with any sub-components. This can be useful and indeed is one way to discover the names you require when building a command to install features however if we just want to see what is installed it is a bit poor.

How can we improve this? Well we have a few options, let us explore them.

Get-WindowsFeature -Name *Teln*

get-windowsfeature name teln

Here we take advantage of a switch for this cmdlet. By using the -Name switch and appending a string we can get a list which matches our pattern – in this instance anything matching *Teln*.

It is also possible to pipe the cmdlet through a where clause filter which gives us the option of filtering against the ‘Install State’ –

Get-WindowsFeature | where {$_.InstallState -eq "Installed"}

get-windowsfeature where installstate eq installed

We can use the same command syntax and use either a ‘Display Name’ or ‘Name’ value to restrict our search to that object as below –

Get-WindowsFeature | where {$_.Name -eq "Wow64-Support"}
Get-WindowsFeature | where {$_.DisplayName -eq "Wow64 Support"}


get-windowsfeature where name and display name eq wow64supportAs you see it is easy to select from the ‘Display Name’ or the ‘Name’ field.

 

Further Information

If you would like additional information then as ever Microsoft have a full reference – https://technet.microsoft.com/en-us/library/jj205469.aspx

There are options for running this command against a remote machine but I will be writing a post for remote PowerShell which will cover this type of functionality.

3 thoughts on “List Windows Server Roles and Features with PowerShell”

  1. I’ve read a few excellent stuff here. Definitely worth bookmarking for revisiting.
    I wonder how much effort you set to create the sort of wonderful informative site.

    Reply
  2. I simply want to say I’m beginner to blogging and certainly savored this blog site. Almost certainly I’m want to bookmark your blog post . You surely come with tremendous posts. Cheers for sharing your web site.

    Reply

Leave a Reply

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