通过注册表项(HKLM\...\WinLogon、Shell)以管理员身份运行应用程序

ins*_*zio 0 vb.net windows registry visual-studio

我开发了一个 vb.net(Visual Studio 2017,.net framework 4.6.1)应用程序,它应该在系统启动时执行,替换 Windows 10 中的“资源管理器”。为此,我修改了 reg 键:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Run Code Online (Sandbox Code Playgroud)

和 Reg 值:

Shell="explorer"
Run Code Online (Sandbox Code Playgroud)

用我的应用程序文件名替换它。

这工作正常,但我还需要以管理员身份运行我的应用程序。我可以在 exe 属性上选中“以管理员身份运行”复选框,或者在我的 VS 项目的 app.manifest 上声明它:

<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Run Code Online (Sandbox Code Playgroud)

这些解决方案阻止 Windows 注册表使用Shell值在启动时运行我的应用程序。

因此,我问您是否有任何方法可以使用Shell注册表值(或其他值)以管理员权限运行应用程序。

非常感谢。戴夫。

小智 5

I had the same problem with a Kiosk app that could not run properly because it didn't had an admin privilege. So instead of granting it admin privileges, I've just lowered down the entire UAC with the reg key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Run Code Online (Sandbox Code Playgroud)

with Reg value:

EnableLUA = 0
Run Code Online (Sandbox Code Playgroud)

Since then, my app's running without any authorization issues.

It might not be straight up solution you look for, but it is an alternative you can think of...