Test for Windows Features

I have an installer that runs CustomAction, which runs a built-in powershell script to check the installed state of various required Windows functions. This works correctly, but it is very slow to complete.

Is there an alternative method for testing such functions? I expect there will be something like registry strings for each function and helper function, but I have not found any documentation on this.

0
source share
2 answers

As a result, I used the (now remote) proposal to use the DTF managed custom action to query server functions in C #.

[CustomAction] public static ActionResult CheckFeatures(Session session) { SelectQuery q = new SelectQuery("Win32_ServerFeature"); ManagementObjectSearcher s = new ManagementObjectSearcher(q); foreach (ManagementObject e in s.Get()) { if((UInt32)e["ID"] == FeatureId) { session["FeatureIsSet"] = "1"; } } } <CustomAction Id="CACheck" BinaryKey="CA" DllEntry="CheckFeatures" Execute="immediate" Return="check" /> <Binary Id="CA" SourceFile="path/to/bin" /> 
+2
source

In one of the installation projects, we used dism.exe to enable the necessary Windows features.

For example, the inclusion of ASP.NET in IIS 8 was performed with the following user action:

 <!-- 32-bit edition of Windows knows where to find dism.exe --> <Property Id="DISMEXEPATH" Value="dism.exe" /> <!-- 64-bit edition of Windows requires this workaround to get proper dism.exe version --> <SetProperty Id="DISMEXEPATH" Value="[WindowsFolder]Sysnative\dism.exe" After="AppSearch">VersionNT64</SetProperty> <!-- And the CA to do the job (with the help of [quiet execution CA][2]) --> <CustomAction Id="SetForEnableAspNetIIS8" Property="EnableAspNetIIS8" Value="&quot;[DISMEXEPATH]&quot; /norestart /quiet /online /enable-feature /featurename:IIS-ApplicationDevelopment /featurename:IIS-ASPNET45 /featurename:IIS-NetFxExtensibility45 /featurename:NetFx4Extended-ASPNET45 /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter" /> <CustomAction Id="EnableAspNetIIS8" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check"/> 

This doesn't sound like good practice, but it worked for this project.

+4
source

All Articles