Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have an application which requires admin rights due to handling process killing -
i need it to start when the user logs-on

ive tried:
- taskschedueler - but i have a few problems with the command line not being efficient enough
schtasks /create /tn mytaskname /tr "myfilelocation" /RL Highest /sc ONLOGON
- since it still checks the "ac-adapter" checkmark amongst others (and /RL doesnt work on win-xp machines)

- regedit
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]

this wont start the winform
even tried -
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit]


still to no avail.

i was thinking about creating a windows service - this seems a bit overkill really.
so my question is - is there any other way - besides taskschedueler, regedit and creating a windows service, that will allow me to start the winform with admin rights at startup
(manifest doesnt help accomplish this btw)
Posted
Updated 31-May-12 0:20am
v4

Rate this:
Please Sign up or sign in to vote.

Solution 1

According to this note[^] on MSDN, the Run key should automatically start the application. Perhaps you could show the exact content of your entry in the registry.
   
Comments
alekcarlsen 31-May-12 6:54am
   
unfortunately, this doesn't start the app with admin privs - which causes the app to close - tried both hkcomp and hkuser - same result for both
Richard MacCutchan 31-May-12 6:55am
   
Then you need to change the properties of the app to do so.
Philippe Mori 31-May-12 12:42pm
   
As far as I know, this is blocked since Windows Vista and there are no easy workaround. This was done on purpose and it if was to easy to bypass, then almost anyone would be able to bypass security. I strongly recommand not to try to bypass Windows security as you will lead Microsoft to add even more security.

And in general an application should not start with administrator priviledge but ask them first time they are required.
Rate this:
Please Sign up or sign in to vote.

Solution 2

i think ive found a move suitable solution http://taskscheduler.codeplex.com[^]
which is an assembly wrapper for task schedueler - which allows fully customized settings..

seems simple enough
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100