Archive: Setting shortcut to run as Admin


Setting shortcut to run as Admin
I have search the forum and read all the thread relating to this topic, but cant seem to get it to work. Here is the code I am using:


createShortCut "$SMPROGRAMS\OSA\Manager.lnk" "$INSTDIR\OSAE Manager.exe"

ShellLink::SetRunAsAdministrator "$SMPROGRAMS\OSA\Manager.lnk"

The shortcut is created, but it is not set to run as administrator. I am testing on Windows 7. Do I need to use the UAC plugin?


Can you do a MessageBox with "$SMPROGRAMS\OSA\Manager.lnk" and make sure the path is correct, if it is not, you have issues with UAC/SetShellVarContext, if it is correct, the problem is with ShellLink::SetRunAsAdministrator


It looks like the path is not correct. what do I need to do to make sure it is pointing to the shortcut?


Make sure the SetShellVarContext mode is the same before the calls to CreateShortcut and ShellLink::SetRunAsAdministrator