سؤال

I have an installscriptmsi project, whose output is setup.exe. I am able to install it on Vista and higher without any issues. I am not prompted for UAC. But on XP, I am prompted with Run As dialog always. I know it is because of setting LAAW_SHELLEXECUTEVERB = "runas" that I am getting the Run as prompt. But I do want my installer to run as admin on XP. I have also set RequiredExecutionLevel as Administrator under Release.

So is there a way I can get the installscriptmsi not to prompt for UAC on XP. I am using IS2012. I am pasting the script below.

function OnBegin()
STRING szProgram, szCmdLine, szDirectory;
NUMBER nShowWindow, nTimeOut, nOptions;
STRING szTestVersionKey;
begin
szProgram = "MsiExec.exe";
szDirectory = "";
nShowWindow = SW_NORMAL;
nTimeOut = 1000 * 60 * 10;
nOptions = LAAW_OPTION_USE_SHELLEXECUTE;
LAAW_SHELLEXECUTEVERB = "runas";

RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );

// uninstall  another 3rd party software if on the system.
szSofTestVersionKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15F6E1D5-12FF-4BBD-B02F-6440C7A2763C}";
if ( RegDBKeyExist(szTestVersionKey) ) then
    szCmdLine = "/uninstall {15F6B1B5-12FF-4DBD-A02F-6640C7A2863C} /norestart /quiet";
    LaunchApplication( szProgram, szCmdLine, szDirectory, nShowWindow, nTimeOut, nOptions ); 
  endif;

end;
هل كانت مفيدة؟

المحلول

You're writing script already, so I would just condition whether you set LAAW_SHELLEXECUTEVERB to runas, or leave it as open. You might compare SYSINFO.nOSMajor to 6, or examine SYSINFO.WINNT.bWinXP to determine which OS you're on, and select the verb accordingly.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top