Checking Server Roles with PowerShell

Checking Server Roles with PowerShell

  • Comments 2

Today I’m rebuilding some of my demo servers in my demo environment and before I can install the software, some pre-requisites need to be checked. You need to check if some Windows Server Roles are installed before starting the installation.

Off course you can just use the Server Manager to check the Roles and if necessary install the missing server roles.

imagec

But it’s much cooler to use PowerShell to check if you have installed the needed server roles Winking smile

Just open Windows PowerShell, load the ServerManager Module and run the Get-WindowsFeature Cmdlet. That’s all to it.

image

And if you want to can also add the missing roles using the Add-WindowsFeature Cmdlet.

Have fun learning PowerShell!

Leave a Comment
  • Please add 1 and 3 and type the answer here:
  • Post
  • Okay, results are on screen.  How do you pipe results to a remove function?  Say you want to remove Directory Browsing, but you don't know whether it exists.  How would this help?

    Thanks

  • Hi OJ King,

    Good question. Get-Help is your friend on this question.

    First open PowerShell, load the ServerManager Module.

    Type: get-help *windowsfeature* and you see that there is also a remove-windowsfeature cmdlet.

    Now you ask get-help for help on the remove-windowsfeature cmdlet.

    Type: get-help remove-windowsfeature -examples

    Now you see some examples and one the examples you can use:

    Get-WindowsFeature Web-* | Remove-WindowsFeature

    Have fun!

    Stefan

Page 1 of 1 (2 items)