Windows Server 2008/Vista- check which server roles installed

565 Views Asked by At

I know that serverManagerCmd.exe -query <foo.xml> will output list of all roles + features in xml format. However, I do not have the ability to parse this easily as I am writing WiX code.

So is there a command which returns different codes depending on whether the server role you specify are installed or not?

Background: I am trying to write a WiX installer which checks if a server role is installed and only runs a command to install if not already installed.

2

There are 2 best solutions below

0
On

I believe the Win32_ServerFeature Windows Management Instrumentation (WMI) class may be of use to you. See also, http://msdn.microsoft.com/en-us/library/cc280268(VS.85).aspx.

I've never used WiX, but I'm assuming it supports WMI.

0
On

AFAIK, there isn't a built in WiX element to allow you to do this.

The best thing to do is probably to write a Custom Action, which allows you to write the logic in C# or VB using all the normal .NET functionality. You can then call that Custom Action from the installer in order to deal with the roles.