How do I preset the output exe with the highest privilege checked? I am having issues for the application running on Windows 7 or Windows 2008, if the user did not select Run As Administrator, the application crashed.
Is there a way to preset the privilege?
Regards
PlayKid
The recommended approach is to add a manifest which requests Administrator privileges:
http://msdn.microsoft.com/en-us/library/bb756929.aspx
Related
Background:
The installation of our application requires Admin privileges.
After the installer has finished we are calling the newly installed program from the installer, and it opens in an Admin window. (This is at least how it works on Windows)
Then when we click on the icon to run the program, it opens another window (thus two instances of the app are running -- not a good thing.)
Is it possible run both the installer and the app from a batch file, so that only after the installer is closed, the app opens in an non-admin window?
(In our app the installer asks for the admin privileges, so the batch file should not do that.)
I tried experimenting with this using "Everything.exe" (an excellent app that requires admin privileges).
REM Test batchfile for opening two apps
"C:\Program Files (x86)\Everything\Everything.exe"
Notepad.exe
unfortunately as soon as Admin privileges are granted to "Everything.exe", Everything loads in the Admin window, and the Notepad loads in the non-admin window.
Is there a way to open the app in non-admin windows after the installer exits?"
You should be able to use MSI (Windows Installer) to install the product with "elevated rights" as opposed to "administrator rights". Windows Installer features a built-in mechanism to impersonate an administrator for the installation transaction when the setup is launched in a regular users login session (there are some policy settings that have to be enabled).
It should also be possible to run an MSI with administrator rights and launch an application from the final setup dialog with regular user rights (perhaps not if launched from an admin rights cmd.exe - not sure, it should launch the msi by right click run as admin) This is possible because the MSI GUI never runs with elevated privileges - it is the installation transaction launched by the GUI that has elevated rights. Once the transaction is complete, the control returns to the GUI running with regular rights. From here you can launch the app via a button click.
This description is somewhat simplified, I'll leave it at that since MSI might not be an option for you.
I'm using a very old version of InstallShield Express 4 to package my VB6 application. Installing it on XP, it works great. But when I install it on a Windows 7 box, not using the "run as administrator", everything seems to be read-only. I can't edit an INI file because access is denied. The application just doesn't function properly. It's almost like it can't even access the folder. And it's installed in the default "program files" folder. I uninstall the application, reinstall using the "run as administrator" option, set compatibility of the short cut to "run as administrator", and everything works fine.
My question is this something inherited in VB6 where the application has to run as administrator or is it an InstallShield issue? And if it is an InstallShield Express issue, would the latest version of InstallSheild Express 2012 fix this? I would prefer the user not have to worry about installing or running the application as an administrator.
Nothing is specifically wrong with your VB6 application. I would say it's the older version of InstallSheild which might be the problem in this case.
The feature is called User Access Control (UAC) that has been introduced in Windows Vista and the following Microsoft operating systems to prevent arbitrarily write access into %ProgramFiles% by applications. You can still perform it manually (by copying and pasting files into %ProgramFiles%) but UAC will prompt for your permission.
To make sure your application behaves expectedly, save application settings in %APPDATA% or in registry, NOT in %ProgramFiles% directory. During installation or uninstallation of your program which requires write access into %ProgramFiles%, you'll have to run it as administrator (unless of course you have UAC disabled which is a massive security risk and strongly recommended against).
Yes, there is something specifically wrong with your VB6 app. It is storing its data in the wrong place. Your application cannot access the program files folder, unless it is running as administrator. This is due to User Account Control, as explained in gsabil's answer.
Here are some solutions (the best one last)
Always run the VB6 app as administrator.
Turn User Account Control off. This opens some security holes and is not recommended
Make your install program change the permissions on your installation directory, granting write access for all users. This is rather a hack, but it could be a fast way to get your program working
Change your application (not your install program) so that it stores its data in %AppData% rather than in the installation directory. This is preferable. Here is some detailed advice on how to do this in VB6
I'm not able to run visual studio 2008 by choosing 'Run as a Administrator' it says 'Application Cannot start'. Any solutions please.
OS : Windows 7 64 bit
IIS 7.5
I've just come across a similar problem myself, where an external tool won't work when VS is run as admin. On my case, the tool tries to access a mapped network folder. Turns out that the mapping applies only for the non-admin login token. Does you VS happen to access a mapped network folder?
See: Programs may be unable to access some network locations after you turn on User Account Control in Windows Vista or in Windows 7. Link includes a possible solution.
BTW, the problem here is probably not VS-specific. Since it seems to regard Windows permissions, it should probably have been asked on ServerFault.
I'm not certain when this problem started occuring, but it was approximately a few weeks ago when I upgraded from Visual Studio 2008 to 2010. I am on Windows XP Professional. The share is on a server running Windows Server 2003. I have a solution which contains a web site (accessed via UNC path, network share) and some class projects that reside on my local workstation. When I open a file from the website, and try to alter and save the file, I get the following error:
" Cannot access this file. Check security privileges over the network drive."
I've checked privileges on the root folder and I do indeed have full control. Could anyone give me any insight as to what I could be missing?
Are you running Windows Vista or Windows 7 with User Account Control (UAC) enabled? If so, Visual Studio 2010 requires administrator permissions to do certain tasks, including IIS management and network share saving.
Try opening Visual Studio 2010 with the Run as Administrator command. Hope that solves your problem.
Turns out a sysadmin removed all permissions and user profiles from a chunk of servers and forgot to inform me. Thanks for the insight, all.
Aside from running as a administrator, is there any workaround for this requirement?
xxx.vbproj : error : The Web
Application Project XXX is configured
to use IIS. To access local IIS Web
sites, you must install the following
IIS components:
In addition, you must run Visual
Studio in the context of an
administrator account.
If you do not want to run as an administrator, then host using the Developer Web Server (Cassini) rather than IIS.
One option - though not recommended by Microsoft - is to turn off User Account Control (UAC):
Disable User Account Control (UAC) in Windows 7
You can active Administrator account and use that account you never get this issue. you can find this post which also works in windws7.
http://knowledgebaseworld.blogspot.com/2009/05/how-to-login-as-administrator-in.html
imran
You need to open your Visual Studio as a administrator (Right click o)