Enable Windows \ Role feature via Installshield

Our application is supported for OS 'Windows server 2012 R2'. We have an application in which we need to enable the "Application Initialization" function. We used Installshield 2014 to install our app installer. I found an implementation to check the status of any Windows function. I tried the following code which gave me a list of installed features:

ManagementClass objMC = new ManagementClass("Win32_ServerFeature");
ManagementObjectCollection objMOC = objMC.GetInstances();
string featureName = string.Empty;
var AppInitFeature = (from ManagementObject objectFeature in objMOC
                      where objectFeature.Properties["Name"].Value.ToString() == "Application Initialization"
                      select objectFeature).First();

      

Here's my question: Is there a built-in capability in installshield to enable a Windows feature? OR we need to write any custom action for this. If we need to write our own action then how to enable Windows feature using C # code.

Can anyone help me on this.

Thanks in anticipation.

+3


source to share


1 answer


As far as I know, installing Windows roles and features is only available for InstallShield AdvancedUI and Suite projects.

Instead, you can create your own installation prerequisite by specifying the installation state of the feature in the registry and manually enabling the desired feature using the script package.

For example, we did the same for our MSMQ prerequisite: Relevant Registry HKLM\SOFTWARE\Microsoft\MSMQ\Setup

, and the entry to check ismsmq_CoreInstalled == 1

Batch file contains call



%SystemRoot%\sysnative\dism /online /Enable-Feature /FeatureName:MSMQ-Server /all

      

and some eye candy.

This solution currently works for all tested Windows systems (these are afaik Windows 7/8 / 8.1 and Server 2008R2 / 2012.

+2


source







All Articles