当 运行 为非管理员但不是管理员时,注册表项可见

Registry keys visible when running as non-admin but not as admin

当我作为普通用户帐户使用 powershell 或在 regedit 中查询时,我有一个可见的注册表项。但是当我 运行 作为管理员的 powershell 或 regedit 时,它没有出现:

非管理员:

PS C:\> Get-ChildItem HKLM:\software\microsoft\windows\currentversion\uninstall | % {Get-ItemProperty $_.PSPath}  | ? { $_.DisplayName -eq "Docker Desktop" }


DisplayIcon     : C:\Program Files\Docker\Docker\Docker Desktop Installer.exe
DisplayName     : Docker Desktop
DisplayVersion  : 2.2.0.4
Version         : 43472
InstallLocation : C:\Program Files\Docker\Docker
NoModify        : 1
NoRepair        : 1
Publisher       : Docker Inc.
ChannelName     : stable
ChannelUrl      : https://download.docker.com/win/stable/appcast.xml
UninstallString : "C:\Program Files\Docker\Docker\Docker Desktop Installer.exe" uninstall
PSPath          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\unin
                  stall\Docker Desktop
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\unin
                  stall
PSChildName     : Docker Desktop
PSProvider      : Microsoft.PowerShell.Core\Registry

管理员:

PS C:\> Get-ChildItem HKLM:\software\microsoft\windows\currentversion\uninstall | % {Get-ItemProperty $_.PSPath}  | ? { $_.DisplayName -eq "Docker Desktop" }
PS C:\>

当 运行以管理员和非管理员身份注册注册表时,会观察到相同的行为。我以管理员身份使用 Avecto DefendPoint 运行 命令提示符(和注册表编辑器)——我不是本地管理员组的成员。这可能与它有关,但我能够在此注册表路径下创建和删除密钥。有趣的是,我可以作为管理员创建一个 "Docker Desktop" 密钥,它不会因为密钥已经存在而失败。我试过 RegDelNull 但它不是嵌入的空问题。

我正在尝试删除注册表项,因为 Docker 桌面仍在 Add/Remove 程序中。我无法从那里卸载它,但按照 https://success.docker.com/article/how-to-completely-remove-docker-in-windows-10

中的步骤操作

注册表中有 "automagic" 位数重定向。

例如 HKLM\SORTWARE\Mirosoft\Windows\Currentversion\Uninstall 在 64 位系统上可能映射到 HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall,具体取决于用于检索注册表项的 API。

当涉及到取决于用户的位映射时,我遇到了很多奇怪的注册表行为(例如,参见 https://github.com/poweradminllc/PAExec/issues/29)。

我建议您使用 Microsoft PSTools PSexec 以系统用户身份调用 regedit(或您的 powershell 脚本),而不是查看以上两个位置。

C:\>PSExec.exe -i -s regedit

希望这对您有所帮助:)

编辑: 虽然不太可能,但您也可以查看用户特定的注册表配置单元,即 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall 作为标准用户。

以管理员身份启动 regedit 后,导航至 HKEY_USERS\S-1-5-21-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-1001\Software\Microsoft\Windows\CurrentVersion\Uninstall,其中 SID (S-1-5-21-*-1001) 是非管理员用户的 SID。

SID可以通过whoami /user命令获取