Checking Server Roles with PowerShell

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.


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.


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

Have fun learning PowerShell!

Comments (11)
  1. Anonymous says:

    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!


  2. Anonymous says:

    Hi Ram,

    What kind of server roles do you want to check? Operations Manager Server roles or just Windows Server roles?


  3. OJ King says:

    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?


  4. Jose says:

    Installed only:

    Get-WindowsFeature | where {$_.installed -eq $true} | select displayname, name, installed

  5. Jose,

    Thanks for explaining.


  6. Ram Karthik says:

    i want to check just check role of server , how cn i do tat

  7. Ram Karthik says:

    Hi Stefan,

    just want Windows Server roles using powershell

  8. mark_praktisero says:

    nice information jose

  9. says:

    worked perfectly !

  10. Harjeet says:

    Awesome, Thank you

Comments are closed.

Skip to main content