Viewing Roles and Features with PowerShell

I am in the process of deploying a fairly large TS Server Farm with Windows Server 2008. You probably know that in 2008, you have roles and features that can be added to the Operating System. In fact, PowerShell shows up as a feature in 2008.

All of these roles and features are managed through an MMC called ServerManager. It's fairly intuitive to add or remove roles and features using this tool. There is also a command line version called servermanagercmd.

I just started playing with this and you can use servermanagercmd to install or remove roles, and you can also use it to query what is installed. The cool thing about the query feature is that it can dump it to an XML file.

So check this out

   1: servermanagercmd -q rolesandfeatures.xml
   2: $xml = [xml](gc rolesandfeatures.xml)
   3: $roles = $xml.get_documentelement()
   4: $roles
   5: $roles.role
   6: $roles.role | ? {$_.Installed -eq "true"} | ft DisplayName
   8: DisplayName
   9: -----------
  10: Terminal Services
  11: Web Server (IIS)


Their is also input functionality built into the tool and I am sure that this is reversible. I'll keep you posted on how that goes.



Comments (1) -

Oh, almost perfect timing that I saw this. We brought up servermanagercmd last night when recording episode 41!  I'll include your script in the next show.  Smile

co-host, powerscripting podcast

Comments are closed