Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been asked to specify the features which are installed on a production web server so a replica test environment can be created.

I could point and click my way to the solution but I am curious as to how this could be done through a script. Powershell or WMI spring to mind. The report should show all the key system features which are installed along with version numbers. Ideally it would also give some information about the installed operating system

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Win32_ServerFeature is what you are looking for if you must script it with WMI. It is only with Windows 2008. Example VBScript code from the MSDN link follows.

strComputer = "FABRIKAM"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFeatureList = objWMIService.ExecQuery _
    ("SELECT Name FROM Win32_ServerFeature")

For Each objFeature In colFeatureList
   WScript.Echo objFeature.Name

Next
share|improve this answer

There is this blog post from MSDN on how to Add, Remove and Query roles on a Windows 2008 Server

From a PowerShell command prompt

servermanagercmd.exe -query roles.xml

See full blog here http://blogs.msdn.com/b/patricka/archive/2008/03/05/detecting-what-server-roles-are-installed-on-windows-server-2008.aspx

share|improve this answer

In Server 2008 R2, it's very simple:

Import-Module ServerManager
Get-WindowsFeature

Hope this helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.