0

I need my application to start with administrator
privilege. When I do it in app.manifest:

'<requestedExecutionLevel
level="asInvoker" uiAccess="false" />'

to

'<requestedExecutionLevel
level="RequireAdministrator"
uiAccess="false" />'

I can start my application with administrator privilege.
But it starts every time the application starts. I need to
start the application with administrator privilege only once at
the first time of application usage.

Actually, I need to make the application to start with
windows instead of starting manually. So to do that I
used:

'My.Computer.Registry.LocalMachine.OpenSubK
("SOFTWARE\Microsoft\Windows\CurrentVersio
\Run", True).SetValue
(Application.ProductName,
Application.ExecutablePath)'

But it requires administrator privilege else it fails.

3
Contributors
3
Replies
22
Views
2 Years
Discussion Span
Last Post by Riteman
1

I suggest you create some sort of installation package which runs with admin rights to deal with registry.

But if your actual app needs to also manipulate reg HKLM then that will need admin rights too.

0

As suzie999 said, the only way to do that is to have a installer app.
So create a installer app in c# and make it copy your main app to its location and then create the registry key.

In your main app, check if the installer app is there and delete it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.