msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Startup app, run as administrator

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
hurricane_number_one



Joined: 04 Oct 2007
Posts: 16

PostPosted: Mon Feb 25, 2008 6:12 pm    Post subject: Startup app, run as administrator Reply with quote

I have a program that needs to be run on startup with administrator
privileges. How can this be done and work in Vista? If I require the
application to run with administrator privileges and just create a
shortcut to it in the startup items, it never runs. I can't see any
other way to do this. I don't want to have to prompt the user to
accept each time either. How can I do this??

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
Bob Butler



Joined: 04 Oct 2007
Posts: 1081

PostPosted: Mon Feb 25, 2008 6:24 pm    Post subject: Re: Startup app, run as administrator Reply with quote

wrote in message @p25g2000hsf.googlegroups.com...
>I have a program that needs to be run on startup with administrator
> privileges. How can this be done and work in Vista? If I require the
> application to run with administrator privileges and just create a
> shortcut to it in the startup items, it never runs. I can't see any
> other way to do this. I don't want to have to prompt the user to
> accept each time either. How can I do this??


Look into making it a service
Back to top
View user's profile Send private message
hurricane_number_one



Joined: 04 Oct 2007
Posts: 16

PostPosted: Mon Feb 25, 2008 10:17 pm    Post subject: Re: Startup app, run as administrator Reply with quote

If I made it a service, how would I get it to run as an administrator?
Would I have to have the user go in and change the run as option, or
would I be able to programatically set it to run as an admin as long
as I had their windows password?
Thanks.


On Feb 25, 4:24 pm, "Bob Butler" wrote:
> wrote in message
>
> @p25g2000hsf.googlegroups.com...
>
> >I have a program that needs to be run on startup with administrator
> > privileges. How can this be done and work in Vista?  If I require the
> > application to run with administrator privileges and just create a
> > shortcut to it in the startup items, it never runs. I can't see any
> > other way to do this.  I don't want to have to prompt the user to
> > accept each time either.  How can I do this??
>
> Look into making it a service
Back to top
View user's profile Send private message
MikeD



Joined: 04 Oct 2007
Posts: 3348

PostPosted: Tue Feb 26, 2008 3:33 pm    Post subject: Re: Startup app, run as administrator Reply with quote

wrote in message @o10g2000hsf.googlegroups.com...
If I made it a service, how would I get it to run as an administrator?
Would I have to have the user go in and change the run as option, or
would I be able to programatically set it to run as an admin as long
as I had their windows password?


You'd have the service log on using administrator credentials. Take a look
in Services (the Log On tab).

--
Mike
Microsoft MVP Visual Basic
Back to top
View user's profile Send private message
Bob Butler



Joined: 04 Oct 2007
Posts: 1081

PostPosted: Tue Feb 26, 2008 1:11 pm    Post subject: Re: Startup app, run as administrator Reply with quote

wrote in message @o10g2000hsf.googlegroups.com...
> If I made it a service, how would I get it to run as an administrator?
> Would I have to have the user go in and change the run as option, or
> would I be able to programatically set it to run as an admin as long
> as I had their windows password?

as long as you know the admin password you can configure it using API calls
CreateService and/or ChangeServiceConfig

IIRC it can also be set using ADSI with
GetObject("WinNT://./,Service")

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group