My installation is installing a web application that is dependent on .NET 
Framework v4 FULL.  One of the actions I take during the installation is to 
confirm that .NET Framework v4 is registered with IIS.  I do this with the 
"aspnet_regiis" utility.  However this utility requires "run as administrator" 
privilege escalation when UAC is turned on.  Because I want to insure the .NET 
Framework is properly registered with IIS prior to our application being 
installed, I execute this custom action as an "immediate" action, After 
CostFinalize.

Currently this all works but requires the installer to open a command window 
with the "Run As Administrator" privilege and manually type in the "msiexec" 
command.  This is on a Windows 7 or later OS with UAC turned on of course.  I 
would like to avoid having the installer take these manual steps so I have 
determined I can escalate the privilege by using the undocumented "runas" 
option in the ShellExecute Method of the "Shell.Application" object.  This 
technique requires two VBscripts.  One for the script to actually execute the 
"aspnet_regiis" command (and associated setup, etc.) and one to launch that 
script with the "runas" privilege escalation.  I have confirmed this works 
using a command window, meaning outside of Windows Installer.  However when 
employing this in my wxs, the "runas" script can't find the targeted script 
with the real work to be accomplished.  I assume this is because at the time my 
"runas" script is executed the installation environment is not clearly defined. 
 Is the "targeted" script available at the time my "runas" customaction is 
executed?  Is there some property or variable I can append to the path of my 
script so it can be found?

Here are some relevant snippets from my WXS and my VB scripts:

>From my WXS:
.
.
.
        <Binary Id="CheckEnvironment" SourceFile="RunAsAdmin.vbs" />
        <Binary Id="ConfirmEnvironment" SourceFile="ConfirmEnvironment.vbs" />
.
.
.
        <CustomAction Id="CheckEnv" BinaryKey="CheckEnvironment" 
VBScriptCall="Main" Execute="immediate" Return="check" />
.
.
.
        <InstallExecuteSequence>
            <Custom Action="CheckEnv" After="CostFinalize">Not 
Installed</Custom>

            <Custom Action="SetPoolIdentityCmdLine" After="InstallFinalize">Not 
Installed</Custom>
            <Custom Action="MakeApplicationPoolIdentity" 
After="SetPoolIdentityCmdLine">Not Installed</Custom>
        </InstallExecuteSequence>


Now from my RunAsAdmin.vbs script:
.
.
.
   vbScriptCmd = "ConfirmEnvironment.vbs"

      vbScriptCmd = vbScriptCmd & " " & QUOTE & progressFileGood & QUOTE & _
         " " & QUOTE & progressFileFail & QUOTE
      AppShell.ShellExecute "cscript", vbScriptCmd, "", "runas", 1
.
.
.
Where "progressFileGood" and "progressFileFail" are two temporary files through 
which the "ConfirmEnvironment.vbs" script
reports its success or failure.  Because the target of the ShellExecute is 
asynchronous, I have to employ a check and sleep method on the
"progress" files to determine when the targeted script is finished.

And now from my "ConfirmEnvironment.vbs"
.
.
.
        strExe = winFolder & 
"\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe"
        strCmd = "cmd /c " & strExe & " -iru 1>" & tempOutFilename & " 2>" & 
tempErrFilename
        runStatus = WshShell.Run(strCmd, 0, TRUE)
.
.
.

Thanks for any advice.




John Stifle  |  Software Engineer  |  TCIS, Engineering and Supply Chain
Unisys  |  2470 Highcrest Rd., Roseville, MN, USA, 55113  |  651-635-7766 |  
Net 524-7766



THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.





------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to