Question

Can install flag application as "runas" administrator?

Asked by: gerry99

I have an application that uses one of Microsoft's samples, Appupdater, to download newer versions of my program from a website, as they become available.  Great, until you try using it under Vista with UAC turned on.

Since User Access Control, prevent writing to the Program Files tree, my updates fail.  If I flag my executable to "Runas Administrator" it runs as expected.

Is there any way to flag an executable as Run as Administrator at intallation time?  Any bits to set in the installation?  If this was possible, I'd expect the UAC to nag about it, but that would be fine.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-02-21 at 15:22:16ID22405099
Tags

runas

,

uac

Topics

C# Programming Language

,

Windows Vista

Participating Experts
3
Points
500
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. RunAS
    Hi experts, I need run my application with administrator privilegues, when user is logged. I read something about this key in registry: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\ <AppID> , where i can put RunAS = administrator. But is didn't work. Why? As <...
  2. Runas + Explorer
    I've been trying to get an instance of Explorer running with admin privileges, but "runas explorer ." doesn't work ...
  3. Runas and explorer instance
    Hello I am trying to do the runas command on any XP or 2000 machine. I have been using a command such as runas /user:domain\administrator \\servername\share and I get the request of the password but no window for the servername and share. I have read http://www.experts-exch...
  4. Vista UAC
    Hi, I developed an application under XP. Now, new users run it on Vista and I have problems with Vista UAC. My app saves to registry and create a small files. If I turn UAC off or right click the icon of my app the set it as administrator, it works fine. if I do nothing, the...
  5. Can't RunAs IE8
    If I use the context menu or command line to use the RunAs functionality to launch IE8 under an account other than the logged on one, it doesn't appear. Any ideas why not as this was fine with IE7? Is there a security setting or reg hack to get this functionality back? Thanks!
  6. runas
    Hello, I am running a program with runas for security reasons. This program print to the default user printer, but if i change the default printer when the program is running, it doesn't print to the new default printer. Do you know how to do this, or a third company program...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: jvuzPosted on 2007-02-21 at 23:18:48ID: 18585522

You can always disable UAC.

 

by: gbzhhuPosted on 2007-02-22 at 04:27:40ID: 18586805

I am having the same problem.  Basically, I am using code that resembles Updater Application Blocks but I wrote it so that I have more control.  My app was being installed under Program Files so had probs with Vista when not logged in as Administrator.  I am planning on doing one of the following and see what happens

1.  Install app under user profile so UAC doesn't complain
2.  Leave app as is but change code to install any files I need to read/write under user profile

See my question here..
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Q_22391543.html

Read the link (Microsoft) on best practices

 

by: gerry99Posted on 2007-02-22 at 12:00:56ID: 18590896

jvuz - I could disable the UAC, but should I ask every customer I have to do the same thing?  I know my program won't harm their machines, but what about anything else they download?

gbzhhu - Can you download new versions of your code to the user's document area and execute that code?  I don't think so, but if you can that's still lousy design.   What I don't see is a thoughtful approach from MS to allow me to right code that downloads newer versions from our website, as they become available.  My code is not sold, however the data it uses - financial - is only available by subscription.  When we fix a problem we want to propogate it to our customers with minimal intervention.  Java applets do this seemlessly.  I don't mind prompting the user if they want to accept changes, but I'd like a way to allow them to update the program without un-installing and re-installing it.  Microsoft seems to have left us with no viable way to make this business model work (unless we ask customers disable their security "improvements").

 

by: gerry99Posted on 2007-02-22 at 13:39:06ID: 18591797

Another question:  How do you installed a signed exe under Vista?  I have an Authenticode signature and sign my setup files.  I tried signing my executable as well.  Under XP it installs with the signature, under Vista installs *without* the signature.  Huh?
The other related thing I noticed was that the EXE has the same properties the 2nd time its installed. If I install once - manually set it to run as administrator, then uninstall, and re-install it has the same privileges the 2nd time, even though I did not set them.

 

by: gbzhhuPosted on 2007-02-23 at 04:14:16ID: 18595183

Regarding your last 2 posts

1.  I think that what M$ is saying is Program Files is a shared area even though the name suggests otherwise and so should allow every user to write/read from.  I will try to download  my code under user's document area.  Disabling UAC is not an option really.  I will let you know what I find as I play around with bloody Vista !

2.  I don't know anything about signing an exe but I saw similar thing happen under vista when I tried to auto update my app.   First I logged in as administrator installed (under My Program Files) my app v 1.4- no problem.  I then run the app.  all is good.  I uninstalled v 1.4 logged off and logged in as NON administrator.  I installed v 1.3 (under My Program Files) no problem!  I run the app and It attempted to detect (via my webservice) that a newer version 1.4 is available.  Now the way I detect is that I have version.config which installed with each version, so v 1.3 has version.config that has
<CurrentVersion>1.3.0.0</CurrentVersion>.
Funny enough when my code read this file I was getting back 1.4.0.0!! I open the file and it says 1.3.0.0!!!  I realised that Vista put a shadow copy of this file under the user profile somewhere (never found out exactly where) and when code fails to read under Program Files it was retrieving the one it left under the user profile folders.

 

 

by: gerry99Posted on 2007-02-23 at 09:58:08ID: 18597849

The shadow copy of write attempts to Program Files goes here:
c:\users\[yourname]\AppData\Local\VirtualStore\Program Files\[company]\[product]\

The odd thing is:  I could install software to "ProgramFiles" ( minus the space ).  And then run my application under UAC with no restrictions.  However, it is useful to have all your programs in one place.  What has changed is that Microsoft has added restrictions to this one place, while most of the rest of the disk remains a free for all.  Does that sound right to you?

 

by: jd2066Posted on 2007-02-25 at 00:47:12ID: 18604485

gerry99: I would guess that if the runas flag was still set that the setting is stored in the registry not part of the file data.
As for the rest of the disk being free for all that does sound a bit odd.
gbzhhu:Having the Program Files folder readable by all is a bad idea. If that is the case one user could download spyware or something to mess up the programs and it would be messed up for all other users too, also if a program is written badly it could possibly mess up other unrelated programs function.
all: I would say installing to the user's profile is a bad idea as then the update would need to be installed for each user.
You could write your auto update program as a service as a service should have the privileges to update program files.
I think Microsoft should have let other programs hook into the Automatic Updates service for their updates.
Justin

 

by: gbzhhuPosted on 2007-02-26 at 03:21:06ID: 18608336

jd2066,

Your points only highlight the problem we are having

>>gbzhhu:Having the Program Files folder readable by all is a bad idea
   -- I am not sure I agree.  The program files is just a folder (it maybe called special folder but it is still a folder).  Just look what happened when gerry99 took the space off and all of a sudden, no restrictions!!  As the name suggests Program Files was supposed to be where programs are installed but who inforces that?  Users can install software whereever they like.  Let's say I installed my app under Program Files.  Since user's cannot read under Program Files I put my support files under user profile.  Another user logs in and can run the app BUT no suuport files accessible to that user, so WHAT is Microsoft trying to telll us? -- I guess I have to do more reading :-(

>>I would say installing to the user's profile is a bad idea as then the update would need to be installed for each user
   -- Makes sense too. WHAT do we do then?

 

by: jd2066Posted on 2007-02-26 at 13:25:29ID: 18612626

From what I've read on other posts you have create a manifest file that tells Vista to run it elevated.
Here is a one link I found on another topic on creating one: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_22156349.html
If that doesn't help I can look for other links.
Justin

 

by: gbzhhuPosted on 2007-02-27 at 03:58:56ID: 18616064

jd2066:

The link above sounds interesting.  I saw the manifest contains requires administrator.  Is that says app requires admin to install or to run?  Wer the steps for VB 6 or .NET?

I am meant to be answering this question but I am asking more questions than the asker :-)))

 

by: jd2066Posted on 2007-02-27 at 10:50:22ID: 18619362

From what I've read you embed the manifest in the application executable and then when the program is run a UAC prompt comes up then after clicking yes it runs the program elevated.
The steps in that link were for VB 6. I just noticed this was in the C# category as I got to this question from the Windows Vista category.
I just did a google search for "Windows Vista Manifest .NET" and found this page http://community.bartdesmet.net/blogs/bart/archive/2006/10/28/Windows-Vista-_2D00_-Demand-UAC-elevation-for-an-application-by-adding-a-manifest-using-mt.exe.aspx
It appears to have instructions for C#.
Though I think those instructions need mt.exe from the SDK here http://community.bartdesmet.net/blogs/bart/archive/2006/10/28/Windows-Vista-_2D00_-Demand-UAC-elevation-for-an-application-by-adding-a-manifest-using-mt.exe.aspx and that appears to be a big download.

 

by: jd2066Posted on 2007-02-27 at 10:52:22ID: 18619384

 

by: gerry99Posted on 2007-03-27 at 11:09:38ID: 18802040

With my program the resolution will be to write any log files to a user area.  The update will attempt to run, and if it fails will prompt the Vista user to click a button to re-install the application overtop the existing one by using a MSI file.

I still think MS's design is bad.  Protecting user's program area is one thing, but it is still their computer, and legitimate users should not be prevented from upgrading programs.  If MS could bring up a prompt and let the user approve of my automatic update, then that would be fine.  Fixing the problem with manifests proved to be too poorly documented.

Gerry

 

by: jd2066Posted on 2007-03-27 at 15:12:07ID: 18803994

gerry99 said:
> I still think MS's design is bad.  Protecting user's program area is one thing, but it is still their computer, and legitimate users should not be prevented from upgrading programs.

I think as long as the program updater runs elevated with confirmation from the user, legitimate users are not prevented from upgrading programs.

gerry99 said:
> If MS could bring up a prompt and let the user approve of my automatic update, then that would be fine.

If you add a manifest to the update program that is what will happen.
If the problem is it's poorly documented then the problem is not bad design just bad documentation.
Justin

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...