How to prevent InstallShield Limited Edition from making some shortcuts "Run as Administrator" - visual-studio-2010

I am using InstallShield 2015 Limited Edition with Visual Studio 2010 to create an installer for a variety of different files, including executables, some Excel spreadsheets, and html pages. The executable files are created by NetBeans. The installer works fine, except for the following behavior with a created shortcut that I don't understand.
NetBeans creates 2 executables: myapp.exe, which is 32-bit, and myapp64.exe, which is 64-bit. I am creating non-advertised shortcuts for these two files. The shortcut for myapp64.exe is created as a "Run as Administrator" shortcut, where the little shield picture is embedded in the shortcut icon, and double clicking the icon brings up the typical prompt window when trying to run an app as administrator. When looking at the Compatibility tab in the shortcut properties, "Run this program as an administrator" has been checked for all users.
The shortcut for myapp.exe is "normal". It can be run as administrator from the right-click context menu, but it is not forced to do so because "Run this program as an administrator" is not checked on the Compatibility tab.
I would like for both shortcuts to be created as "normal", to avoid the annoying prompt window, but I can't figure out why the shortcut for myapp64.exe is created as a "Run as Administrator" shortcut. I checked myapp64.exe with the MT tool, but there is no manifest, and the properties for myapp64.exe do not require admin privileges anywhere that I can find. I can't find any InstallShield settings that would make the shortcut "Run as administrator". I have deleted and re-created the shortcut in the installer project, but that doesn't solve the problem. If I manually modify the shortcut for myapp64.exe after installation to uncheck "Run this program as an administrator", the app runs fine.
Finally, this behavior doesn't seem to happen all the time. It happens in Windows 7, but does not seem to happen in Windows 10. I am only working with 64-bit operating systems.
Any ideas what is going on, or how to prevent the myapp64.exe shortcut from being created to run as an administrator? Is the Windows Installer seeing something that is causing it to make the shortcut this way?
I posted in the Flexera forum for InstallShield LE, but didn't get a response.
Thanks!

Related

Make Visual Studio 2019 Always Run as Administrator from Start Bar Recent Solutions List

I recently upgraded to Windows 10 and Visual Studio 2019.
Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.
The primary one is that it will not load my projects that use my local instance of IIS.
I usually launch Visual Studio from my start bar. Right now this goes like this:
Right click on the icon on the start bar and select my solution.
It loads and then I realize that the main project did not load.
Close visual studio, open as admin
Pick my solution and then it loads.
I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?
Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)
Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.
But this did it:
Find devenv.exe (Visual Studio's executable)
Right Click on it and select "Troubleshoot Compatibility".
On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
Check that the program requires additional permissions and click Next
On the next window, click on Test the program… and VS will open as administrator
Click next and then click on Yes, save these settings for this program
Now Visual Studio will ALWAYS run as administrator.
(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)

Visual Studio 2017 - Open in Visual Studio from Explorer - Permission Error

I am using VS 2017 Enterprise.
I have it setup to open/run in Administrator mode which is working for SLN files.
However I'm trying out the new "Open in Visual Studio" feature by right clicking on a folder in Explorer. I'm receiving the following permission error. It's happening for every folder I try.
VS Code has no problem however.
Is there something more I need to enable?
My first guess would be that the VS 2017 application itself (devenv.exe) is configured on that machine to always Run as Administrator see https://technet.microsoft.com/en-us/library/ff431742.aspx on how to change it:
To mark an application to always run as an administrator, do the following:
1. On the Start menu, locate the program that you want to always run as an administrator.
2. Right-click the application’s shortcut, and then click Properties.
3. In the Properties dialog box, click the Compatibility tab.
4. Do one of the following:
- To apply the setting to the currently logged-on user, select the Run This Program As An Administrator check box, and then click OK.
- To apply the setting to all users on the computer and regardless of which shortcut is used to start the application, click Change Setting For All Users to display the Properties dialog box for the application’s .exe file, select the Run This Program As An Administrator check box, and then click OK twice.
See also list of things that you can't do without administrator account https://msdn.microsoft.com/en-us/library/jj662724.aspx. What typically makes Web-developers to make VS always run as administrator is "Deploying a web application to Internet Information Services (IIS) on a local computer." and "Debugging applications that a run under a different user account, such as ASP.NET websites."
For me it has worked as it should, at least this can help you.
First question is how you "setup to open/run in Administrator mode" ?
Using the "Advanced button" of the Visual Studio 2017 shortcut is not enough because methods with the right mouse button don't use this shortcut.
Using the method of the compatibility tab as mentioned already by SergGr
(https://technet.microsoft.com/en-us/library/ff431742.aspx) has worked for me, and I have been able to use it for folders as well as for solution files !
I am logged in as a member of the local admin group and UAC standard setting into Win 8.1 .
Another possibility instead of using the compatibility page would be to inject an own manifest into devenv.exe. Neither of the two is very clean (I am no fan of the whole compat layer, but it helps here a bit).
Have you tried to switch UAC off temporarily for a test? Or how you have configured UAC?
If you have done it the way described, the explorer should come up with a correct UAC message.
This works for me if not for you then refer to (https://marketplace.visualstudio.com/items?itemName=GregTrevellick.OpeninVisualStudio2017Enterprise):
1. open notepad.exe and paste this into it:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\VSCode\command]
#="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"%1\""
here is my registry file exported just incase you need it (you shouldnt):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\VSCode\command]
#=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,\
4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,53,00,20,\
00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,00,78,00,\
65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00
2. save as VSElevated.reg
3. go to where you saved the .reg file and double click, yes to everything and ok.
4. This is how your Registry should look like afterwards:
The reason i think is the %1 is missing in your launch command. This should solve it.

How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu?

I have been researching around the web trying to figure out how to add Run As Administrator as the default menu item for a Visual Studio solution when you:
right-click the solution in Windows Explorer
right-click on a pinned application, such as Visual Studio 2013, to bring up the Jump List and then select the solution
The instructions that I have found so far:
http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/
show how to easily add the Run As Administrator menu item to an existing file type. You just have to find the right registry keys for the Visual Studio version that you're working with. For example, Visual Studio 2013's registry key for its solution file type is:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0]
Then you just copy the Open command under the shell key, then paste it in as a new key whose name is runas.
After that change, when you right-click on the solution in Windows Explorer, Run As Administrator is in the list of commands. But it is not the default.
To open the solution as Administrator from the Jump List menu, when you right-click on Visual Studio as a pinned icon, you have to right-click on the solution file in the Jump List, then select Run As Administrator.
But I couldn't find anywhere about how to make the Run As Administrator the default command in this menu.
So how do you do that?
Easiest way is doing this:
Right click visual studio and open file location.
(If it's the shortcut, right click then click properties. On the bottom click on "Open File Location")
This should lead you to devenv.exe.
Right click this and select troubleshoot compatiblity.
Select troubleshoot program and check off the box for "The program requires additional permissions" and select next.
Now if you open visual studio from where ever, it'll open it as an administrator.
It actually turns out to be one additional registry entry that needs to be set. In the shell key under the file type, change the value of (Default) to be the same name as the command in the registry under the shell folder.
For example, to set Run As Administrator to be the default, you would set the value of (Default) in HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell to be runas.
When exported, this setting looks like this:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell]
#="runas"
Now when you right-click the solution in Windows Explorer, or when you right-click the solution after right-clicking to bring up the Jump List on the Visual Studio 2013 pinned icon, Run As Administrator is the default command instead of Open.
So you can confidently open the solution itself from Windows Explorer or the Jump List menu and watch as Visual Studio opens as Administrator.
Updating answer for Visual Studio 2015 (under covers version "14.0"). Tested on on Windows 10 Pro v1703 Creators Update. Picture below illustrates the first registry change. Second change goes one better - no need to right-click the jump list item at all.
Windows Registry Editor Version 5.00
;To add "Run As Administrator" to Visual Studio 2015 Taskbar Jump List solution right-clicks
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs]
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs\command]
#="\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv.exe\" \"%1\""
;To make Jump List solutions open As Administrator by default
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell]
#="runas"

Visual Studio does not let me drag drop items into it?

Using Visual studio 2010 I got problems when double-clicking, for example a config file (*.config). Visual Studio would open but give me a error message about parameters. If I simple try to drag and drop a file that Visual Studio usually can read in to it, the icon will give me the "not possible icon"?
I have now installed Visual Studio 2012 and it has the same problem?!
This makes my work a lot harder, it should be easy to just drag & drop files into Visual Studio, but it's not so? Now I have to manually find the file with the file menu?
Please note, I have re-installed the computer before installing Visual Studio 2012.
On Windows Vista and newer Windows Explorer runs with medium integrity level.
If you run Visual Studio as administrator (high integrity level) then for security reasons OS will disable drag and drop from Explorer to Visual Studio.
You can either run Visual Studio as normal user or you can install VSCommands for Visual Studio 2012 extension. It has several features that can help with this such as:
Elevated Windows Explorer - small tool which looks like Windows Explorer but runs with elevated permissions allowing Drag And Drop
Directory Explorer - tool window inside Visual Studio which again looks like Windows Explorer and allows Drag And Drop
Run Visual Studio with medium integrity - allows Drag And Drop from Windows Explorer, but you won't be able to attach to processes run by other users (e.g. IIS)
If you run VS as administator, instead drag n drop, do copy (either ctrl+c, context menu "copy") the file selection in explorer and paste (ctrl+v, context menu) on selected node in VS
This was driving me nuts. In my Visual Studio solution I have two Web Application which use IIS as web server so because of this I have to always start my Visual Studio in Administrator mode. After starting as Admin I wasn't able to drag and drop files from Explorer to Visual Studio.
Solution:
Open Command Prompt as Administrator (Shortcut for Windows 8.1 is ⊞ Win + X + A)
Type "explorer" this would open Windows Explorer with Admin privileges.
And now you should be able to drag and drop any file from explorer to Visual Studio
If you disable UAC completely you can drag & drop from anywhere again. To do this you can't use the slider in the Control Panel because that only brings the UAC level down to 1. Make this registry change, reboot, and you can again use your computer like god intended.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000
I think the main goal of this question is how to add many folders and files to your project in a comfortable way. Drag and Drop files into your project is one solution, which fails under certain circumstances.
Another very easy way is:
Copy the new folders and files where you physically want them in your project
Open the project explorer in VS and click the button "Show all files"
All the folders and files, which are now not part of your project yet appear white
Select the the white folders or files, right-click and choose "Bind to project"
Done
This is also possible, if you run VS as admin.
Have some fun!
By the way: I found this question, because I had the same issue with drag and drop. I understand the security issues, but it is an annoying feature.
I'm using this easiest approach. When you run Visual Studio in Administrator Mode. When you need to drag and drop, just press CTRL+O to open up a file browser within visual studio, and use that file browser as an Elevated Explorer to do your drag and drop.
I had a similar problem but my issue was a bit different. I was trying to drag and drop a file from inside a zipped folder. Once I unzipped the folder drag & drop started working again.
I had this problem as well because I was opening VS in admin mode and the file explorer by default is not in admin mode.
Ended up creating a PowerShell and bat script to start explorer in admin mode every time the computer start.
admin.bat file:
#ECHO OFF
PowerShell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"
admin.ps1 file:
taskkill /f /im explorer.exe
start-process explorer.exe
The files just have to be in the same folder. Doesn't matter what they are called. Run the .bat file to restart explorer in admin mode or just create a shortcut to the .bat file in the startup folder ;) the script and ps1 file can be hidden.
On windows 8.1, change the registry key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA and set value = 0.

How can I edit command-line args in shortcuts generated by InstallShield?

Sometimes when an installer installs a program, and creates shortcuts, for some reason they aren't "normal" shortcuts. They have the Target textbox and Open File Location button greyed out, like such:
I'm using InstallShield 2011 LE (Limited Edition) for Visual Studio 2010. It works as advertised, but I don't see any options to change the way it creates shortcuts. The program I'm installing would greatly benefit from adding command line arguments to that Target textbox. If I go find the executable in Program Files, and Send To -> Desktop (create shortcut), I (and my users) can modify that one, no problem. I don't want to have to make them go through this step, though.
How are shortcuts placed by an installer different from "normal" shortcuts?
In InstallShield, set the Advertise property to "no".

Resources