Beginning with Server 2008 R2, there is a PowerShell module called ServerManager that you can use to manage server features and optional components. Simply import the module in PowerShell v2:
PS> Import-Module ServerManager
In PowerShell v3, the module is imported automatically on demand.
Next, you can obtain a list of installed components, like this:
PS> Get-WindowsFeature *file* PS> Get-WindowsFeature *powershell*