InnoScript - The shortcut asks for UAC? - windows-10

I am creating an installer in InnoScript. I am facing an issue. I use the following code to create the shortcuts,
Name: "{commonstartmenu}\{#MyAppPublisher}\{#MyAppName}"; Filename: "{app}\MyProg.exe"; IconFilename: "{app}\MyIcon.ico"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\MyProg.exe"; IconFilename: "{app}\MyIcon.ico"
On Windows 10 the created icons shows the UAC shield icon and asks the user the UAC message to run as administrator when opened.
This does not happen in Windows 7. It runs without asking UAC message.
How to prevent from showing the UAC message in Windows 10?

It seems the installation directory already existed with limited user access. This is why it asked for UAC. When another folder location was selected, it did not ask for UAC.

Related

Installing MS SQL Server Express 2017 with Inno Installer

I'm desperately trying to install SQL Server Express 2017 with Inno Installer.
Within my installer I include the extracted installer files.
That means that I already executed the common SQLEXPR_x64_ENU.exe, to avoid the "extract-temp-folder" prompt while my installer is running.
I execute the following on the cmd:
{somePath}\SQLEXPR_x64_ENU\setup.exe /ACTION=Install /Q /SKIPRULES=RebootRequiredCheck /SUPPRESSPRIVACYSTATEMENTNOTICE=1 /IAcceptSQLServerLicenseTerms=1 /SECURITYMODE=SQL /SAPWD=secretPW /ConfigurationFile=ConfigurationFileExpr.ini
The install succeeds.
But when I do the same within my InnoInstaller-File like this:
...
[Files]
Source: "SQLEXPR_x64_ENU\*"; DestDir: "{tmp}\SQLEXPR_x64_ENU"; Check: not SQLExpress_Check; Flags: recursesubdirs;
[Run]
Filename: "{tmp}\SQLEXPR_x64_ENU\setup.exe"; Description: "Installing SQL Server Express 2017..."; StatusMsg: "Installing SQL Server Express 2017..."; \
Parameters: "/ACTION=Install /Q /SKIPRULES=RebootRequiredCheck /SUPPRESSPRIVACYSTATEMENTNOTICE=1 /IAcceptSQLServerLicenseTerms=1 /SECURITYMODE=SQL /SAPWD=secretPW /ConfigurationFile=ConfigurationFileExpr.ini"; Check: not SQLExpress_Check; Flags: runascurrentuser;
...
SQL Installer fails with the following error:
Exception type: System.MissingMethodException
Message:
Method not found: 'Void Microsoft.SqlServer.Chainer.Infrastructure.RoleService.Initialize(Microsoft.SQL.Chainer.Product.RolesType)'.
HResult : 0x80131513
Data:
DisableWatson = true
Stack:
at Microsoft.SqlServer.Configuration.BootstrapExtension.InitializeRoleServiceAction.ExecuteAction(String actionId)
at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.<ExecuteActionWithRetryHelper>b__b()
at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
Is this a permission error?
I do not have a clue.
On cmd-shell it works, but not on InnoInstaller.
Thanks in advance for your efforts and have a nice day.
Solution for me was provided by Gavin Lambert on the Inno Setup Forum :
If you're [installing from the directory of unpacked files], you need to use {sd}\shortname as the DestDir (usually combined with deleteafterinstall) -- you can't put the files in {tmp} or any similar path as the files are very deeply nested and the db installer ends up failing to access some files because the path is too long.
If you use an unpacked installer file, here is what should work absolutely perfect.
SQLEXPR_x64_ENU.exe /x:%temp%\SQLEXPR_x64_ENU\ /QS /ACTION=Install /SKIPRULES=RebootRequiredCheck /SUPPRESSPRIVACYSTATEMENTNOTICE=1 /IAcceptSQLServerLicenseTerms=1 /SECURITYMODE=SQL /SAPWD=secretPW /ConfigurationFile=ConfigurationFileExpr.ini
In the above command, /x:%temp%\SQLEXPR_x64_ENU\ is the very important switch where it describes the extraction location and with combination to /QS it will show you the progress on screen but will not ask for any input.
You may have to change %temp% to appropriate command to grab a windows temporary folder in your installer. The command I have posted is good for command-line execution.
Enjoy! :)

Startup folder shortcut not created

Here's part of my inno setup script:
[Setup]
PrivilegesRequired=admin
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
When i open the startup folder Win+R and type "shell:startup", there is no such folder created after the setup completed. The normal Program folder is created though. As I understand, to modify commonstartup, requires admin privilege and I have added this entry in Setup, but still not working. Anybody have any idea why and how to fix this?
EDIT: ok i tried with {userstartup} then it works. so my question is why the commonstartup one can't work?
The shell:startup opens user's "startup" folder, not the common one.
To open the common one, use shell:common startup.

Inno Setup desktop shortcut (link) which has "Run as administrator" advanced property set

I am struggling to get Inno setup (5.5.9u) to created a desktop shortcut that has an icon and has the advanced property of "Run as administrator" set.
Issue
This question, is a little different than: How to set 'Run as administrator' on a file using Inno Setup
Since what I am trying to do is not run a program at setup time with admin rights, (setup is already running at Admin), but rather leave a link on the desktop that has has the advanced property of "Run as Administrator".
Code Sample
[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; \
WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe main.js"; \
WorkingDir: "{app}\dashboard"; \
IconFilename: "{src}\dashboard\build\configure.ico"
First, make sure you have a very good reason to run your application with Administrator privileges. User applications should not need Administrator privileges. If they need it, it's usually a sign of a bad design. One common (bad) reason to want an application to run with Administrator privileges, is that the application needs to write to its installation folder.
See Application does not work when installed with Inno Setup
Inno Setup does not natively support creating a shortcut with "Run as Administrator" flag set.
The "Run as Administrator" flag is a bit the .lnk file. See:
LinkFlags in [MS-SHLLINK]: Shell Link (.LNK) Binary File Format;
How to create a Run As Administrator shortcut using Powershell
How can I use JScript to create a shortcut that uses "Run as Administrator"
You can set the bit using the following code:
[Icons]
Name: "{userdesktop}\My Program"; Filename: "{app}\MyProg.exe"; \
AfterInstall: SetElevationBit('{userdesktop}\My Program.lnk')
[Code]
procedure SetElevationBit(Filename: string);
var
Buffer: string;
Stream: TStream;
begin
Filename := ExpandConstant(Filename);
Log('Setting elevation bit for ' + Filename);
Stream := TFileStream.Create(FileName, fmOpenReadWrite);
try
Stream.Seek(21, soFromBeginning);
SetLength(Buffer, 1);
Stream.ReadBuffer(Buffer, 1);
Buffer[1] := Chr(Ord(Buffer[1]) or $20);
Stream.Seek(-1, soFromCurrent);
Stream.WriteBuffer(Buffer, 1);
finally
Stream.Free;
end;
end;
Tested on Unicode version of Inno Setup (the only version as of Inno Setup 6). But it should, even more naturally, work on Ansi version too.

Inno Setup Start menu uninstall shortcut is not shown on Windows 10

I've got an issue that seems to be specific to Windows 10 with the Start menu uninstall shortcut I create in my setup. The shortcut is simply not shown.
However, others shortcuts I create are shown as well...
Here is the value for DefaultGroupName:
DefaultGroupName={#MyAppPublisher}\MyCompany\MySoftwareName
Here are my entries for shortcuts in [Icons] section:
[Icons]
Name: "{group}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\MyExeName.exe"; WorkingDir: "{app}"
Name: "{commondesktop}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\MyExeName.exe"; WorkingDir: "{app}"; IconFilename: "{app}\MyExeName.exe"
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\MyExeName.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon
Name: "{group}\{cm:UninstallProgram, {#MyAppName} {#MyAppVersion}}"; Filename: "{uninstallexe}"; WorkingDir: "{app}"; IconFilename: "{app}\Remove.ico"
Name: "{group}\{cm:SHORTCUT_SAV}"; Filename: "{code:GetDataDir}"
I've tried a simple entry too:
Name: "{group}\Uninstall My Program"; Filename: "{uninstallexe}"
But shortcut is still not shown.
Note that this works fine in any previous version of Windows...
Do you have any idea on this? I've search but I have not found any topic related to this specific problem.
Windows 8 and newer employs lots of optimizations to the Start menu to reduce number of items shown.
For example it won't display two shortcuts pointing to the same target, no matter, if the shortcuts have different labels or are placed in different menu folders.
You are probably a victim of such optimization.
Anyway, what you are trying to do is against Windows guidelines:
You should not use Start menu folders in Windows 8 and newer.
You should not add a shortcut to an uninstaller to the Start menu, on any version of Windows. The user should go to Control panel or Settings app to uninstall a program (that's also a possible explanation, why the shortcut is not shown).
I had the same problem.
In my case sometimes only the uninstall shortcut in windows start menu disappers.
Somehow I fixed it.
Just use in Icons-section the command to create this shortcut twice. Their names need to differ.
For example:
Name: "{group}\{#Uninstall_Name} {#MyAppName}"; Filename: "{uninstallexe}";IconFilename: {app}\{#IconFileStartDesktop};
Name: "{group}\{#MyAppName} {#Uninstall_Name}"; Filename: "{uninstallexe}" ;IconFilename: {app}\{#IconFileStartDesktop};
If the first uninstall-shorcut does not show up, the second one will do it.
new to the group and to INNO. :)
I figured a workaround to have an UNINSTALL entry in the START MENU.
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppNameShort}}"; Filename: "{#MyUninstallFilesDir}\unins000.exe"; Tasks: startmenu
It's not elegant having to hard-code the EXE, but it works in Win10 64-bit. My plan for updates is to uninstall the Access Front-end, leave the Back End alone, and reinstall only the Front-end.
(in theory...)
Robert
:)
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}
Just insert the command twice..done:)

inno setup icons filename in server

hi i am havinf trouble with icons,on the setup part i have got this:
UninstallDisplayIcon="X:\Design\IdOntime\icon_ontime.ico"
this icon is in a server, and i can reach the server folder in a mapped drive, in this case x:.
So this is saying where the uninstall icon is, and when i run setup the uninstall icon appear correclty.
Now moving to the icons on the desktop and the init menu..
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "X:\Design\IdOntime\icon_ontime.ico"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "X:\Design\IdOntime\icon_ontime.ico"
i am using the same path, but this time instead of the icon , it appears a blank page. What i can understant is that the windows didnt find the icon so it is puting a default icon.
what is even more stange is that if i change the path of the icon to a local path, it works.
so does inno setup icons section doenst like mapped path?
thanks in advance..

Resources