0
votes

I have installed an application using NSIS with administrative permissions. Then switched to normal user (without administrative permissions) to launch the application. But here I am not seeing start menu and system tray.

Below is the code snippet I used:

RequestExecutionLevel admin

; To show the system tray notification 

ExecShell "" "$INSTDIR\test.exe"

; To show the installer icon at the start menu

createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\Myapp.exe" "" "$INSTDIR\test.ico"

I Need to check the Admin user only when installing the installer and not for launching the application.

Please help me by providing the changes required to show the start menu and the system tray for the normal user as well.

1

1 Answers

1
votes

Use SetShellVarContext to switch constants to "all users"/machine mode:

RequestExecutionLevel Admin

Function .onInit
SetShellVarContext All
FunctionEnd

Section
CreateShortcut "$SMPrograms\Test.lnk" "$SysDir\Notepad.exe" ; Created in the shared startmenu folder
SectionEnd

Create a shortcut in the Startup folder or Run registry key if you want your application to start when a user logs in.