Page 1 of 1

Desktop shortcut not running as Administrator

Posted: Sat Jul 09, 2016 9:20 pm
by Edhy
Hi,
I am creating a Desktop shortcut with the option to "Run as administrator" but after installing it, this option will be disabled on end user computer.
I am using IA Studio X4 Build 5.13.2016 (Buddha), and I am testing this on 2 Windows 7 Pro VM x86 and x64. If I install the shortcuts on other locations like $QUICKLAUNCHDIR$, $SHORTCUTFOLDER$ or $SHORTCUTROOT$ it will work as expected, only the one with link Location $DESKTOPDIR$ will not have the "Run as Administrator" checked once installed.

Here is the command:

Code: Select all

  Create Shortcut $DESKTOPDIR$\TBR Utility to $TARGETDIR$\TBRUtility.exe, run as administrator

Code: Select all

~InstallAware Clipboard Data~
~Create Shortcut~
~{06E79C46-14E9-490A-9494-2DDF9E9A270A}~
~$TARGETDIR$\TBRUtility.exe|FALSE~
~TBR Utility~
~$DESKTOPDIR$|FALSE~
~ThomBiller Revision Utility~
~~
~|TRUE~
~|FALSE~
~|~
~0|~

Any idea on what may be wrong will be greatly appreciated as always!!!
Thanks

P.S.
I already looked a the "Shortcuts sample" available from the following link http://www.installaware.com/forum/viewtopic.php?f=2&t=6772&p=25655#p25655 and don't see anything different that what I am doing.

Re: Desktop shortcut not running as Administrator

Posted: Mon Jul 11, 2016 12:11 pm
by FrancescoT
Dear Edhy,

I'm not able to replicate the error you seems to have.
I tried to use the code you posted (I had to change the target file, of course) ... at any rate, the desktop shortcut gets elevated as expected.

Regards

Re: Desktop shortcut not running as Administrator

Posted: Mon Jul 11, 2016 12:38 pm
by Edhy
Hi Francesco,
Did you try on the same build number I have?

This is very weird since the shortcuts created on other locations are properly elevated. I tested this on my 2 virgin VM as well as on the end users computers on another network and in all instances the desktop shortcut is not elevated, very weird.

Re: Desktop shortcut not running as Administrator

Posted: Mon Jul 11, 2016 1:11 pm
by FrancescoT
Dear Edhy,

yes, I used the same identical IA build.

By the way, did you try to run the "Shortcuts sample"? I used that project to test your code ... and it works.

Regards

Re: Desktop shortcut not running as Administrator

Posted: Mon Jul 11, 2016 1:20 pm
by Edhy
Hi Francesco,
By the way, did you try to run the "Shortcuts sample"? I used that project to test your code ... and it works.

I just did and it worked too on my both VM, which means that something is wrong with my installation setup.

I have no idea what may be wrong with my setup, I created this one from scratch, obviously it does have many other things, like installing a service, using NATIVE CODE, etc. which the simple shortcut demo does not have.

Re: Desktop shortcut not running as Administrator

Posted: Mon Jul 11, 2016 4:10 pm
by Edhy
Hi Francesco,
After your comment about the "Shortcut Sample" application, I decided to look closely at the code and compare it with mine and I found the fix.
After the "Main Install" label this code is placed by default by the New Project Wizard:

Code: Select all

if Variable ALLUSERS Equals TRUE
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILESALL$\$STARTMENU$
  else
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILES$\$STARTMENU$
end


The sample application has the following code, with a redefinition of the DESKTOPDIR variable based on the ALLUSER value. I added those 2 lines to update the DESKTOPDIR value and now my desktop shortcut is created with the elevated check.

Code: Select all

if Variable ALLUSERS Equals TRUE
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILESALL$\$STARTMENU$
  [b]Get Common Folder Location System->Desktop Directory into DESKTOPDIR[/b]
  else
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILES$\$STARTMENU$
  [b]Get Folder Location System->Desktop Directory into DESKTOPDIR[/b]
end

I will suggest that you create a small project from the wizard and try to replicate the issue. It seems to me that if those 2 lines are not in the base template, then it may be considered as a bug.

Thanks again!!!