通过 NSIS 卸载时,Windows 控制面板需要管理员权限 [英] Windows control panel requires admin privileges when uninstall via NSIS

查看:60
本文介绍了通过 NSIS 卸载时,Windows 控制面板需要管理员权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 NSIS 安装程序/卸载程序,它只为当前用户安装一个应用程序.HKCU 中有注册表写入,以使应用程序出现在控制面板中.它工作得很好.但是,当我尝试从控制面板卸载应用程序时,它会弹出管理员权限弹出框(AUC 内容)并以管理员身份运行卸载程序.因此 HKCU 与管理员帐户相关,而不是用户帐户.通过这种方式,用户可以卸载"管理应用程序!我需要允许用户在没有管理员权限的情况下卸载应用程序.

I have a NSIS installer/uninstaller which install an application for the current user only. There are registry writings in HKCU in order to make the application appears in control panel. It works perfectly well. However, when I try to uninstall the application from control panel, it pop-up the admin privileges pop-up box (the AUC stuff) and run the uninstaller as admin. Therefore HKCU is related to the admin account and not the user account. In this way, a user can 'uninstall' the admin application! I need to allow a user to uninstall the application without admin privileges.

我已经在使用 !include MultiUser.nsg 等.我还注意到可以在用户级别(不需要管理员权限)从控制面板卸载一些随机/默认 MS 应用程序,所以我知道这是可能的.

I am already using !include MultiUser.nsg et al. I've also noticed that it is possible to uninstall some random/default MS applications from control panel at user level (which doesn't require admin privileges) so I know it is possible.

推荐答案

从经典控制面板中的旧程序和功能"卸载,无需 UAC 提示即可正常工作.我刚刚在 Windows 10.0.16184 上进行了测试:

Uninstalling from the old "Programs and Features" in the classic control panel works just fine without UAC prompts. I just tested on Windows 10.0.16184 with this:

InstallDir $Temp\Test
RequestExecutionLevel user

Section
SetOutPath  "$InstDir"
WriteUninstaller "$InstDir\Uninst.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test" "DisplayName" "NSIS W10 HKCU Test"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test" "UninstallString" '"$InstDir\Uninst.exe"'
SectionEnd

Section Uninstall
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test"
Delete "$InstDir\Uninst.exe"
RMDir "$InstDir"
SectionEnd

然而有一个

设置应用程序中的这个问题已经存在几年了,我认为微软并不关心.

This issue in the settings app has existed for a couple of years now and I don't think Microsoft cares.

这篇关于通过 NSIS 卸载时,Windows 控制面板需要管理员权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆