I have a kiosk app and want to run it at startup. The problem here is that when I put Registry value to open it at startup, it doesn't open program as Administrator and so that program doesn't work probably. I'm using Windows 7. Can anyone help me with code to run it as Administrator? Some programs (such as anit-viruses and the viruses themselves) work as Administrator at startup WITHOUT ASKING THE USER TO ACCEPT RUNNING AS ADMINISTRATOR, that's exactly I want to do. Any help is very thanked.
Running Program as Administrator at Startup
Asked Answered
check this post –
Cistern
@dgvid are you on drugs? that duplicate you noted has nothing to do with this post, its really annoying how so many of you mods go around close-tagging without understanding the basic rules of closing a post. If the duplicate post cannot provide the answer the current poster is seeking, specifically for his or her needs, it cannot be considered a duplicate. And in your case, the questions aren't even the same, nor are the answers even relevant to one another. Please stop the close-nagging, don't be another capserOne (user casperOne). –
Michaelamichaele
I'm not on drugs and did NOT close tag the question. Thanks for pointing out my error, though. I will be more careful. –
Domination
To run a application at startup, you can either:
- Run it as a scheduled task, set the credentials to run as the Administrator account, and set it to run at startup (or login).
- Create a Windows Service, and set the Logon As account to the Administrator account or the Local System account.
Your example of the antivirus software sounds like #2.
You can set the program so you can only run as administrator.
In Visual Studio:
Right click on the Project -> Properties -> Security -> Enable ClickOnce Security Settings
After you clicked it, a file will be created under the Project's properties folder called app.manifest once this is created, you can uncheck the Enable ClickOnce Security Settings
option
Open that file and change this line :
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
to:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
This will make the program require administrator privileges, and it will guarantee you have access to that folder.
very nice, but when program runs as Administrator it doesn't start at startup, this is my problem. –
Emilioemily
© 2022 - 2024 — McMap. All rights reserved.