Checking Server Roles with PowerShell

Checking Server Roles with PowerShell

  • Comments 8
  • Likes

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!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • 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

  • Installed only:

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

  • Jose,

    Thanks for explaining.

    Stefan

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

  • Hi Ram,

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

    /Stefan

  • Hi Stefan,

    just want Windows Server roles using powershell

  • Hi Ram,

    Check technet.microsoft.com/.../ee662311.aspx

    /Stefan