更新时间:2023-02-06 11:57:06
我不会将 hive 附加到 HKLM.您应该将其附加到 HKEY_USERS (HKU).这就是它的用途.
I would not attach the hive to HKLM. You're supposed to attach it to HKEY_USERS (HKU). That's what it's for.
试试:
reg.exe load HKU\Changeuser c:\users\testuser\ntuser.dat
Write-Host Loaded with result $?
您可以像这样访问它:
Set-Location Registry::\HKEY_USERS\Changeuser
如果您想要一个 PowerShell 驱动器(HKEY_USERS 通常没有),您可以使用:
If you want a PowerShell drive (HKEY_USERS normally doesn't have one) you can use:
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS;
Set-Location HKU:
为了扩展,我已经使用 at.exe
作为服务帐户和本地 SYSTEM 帐户运行的 Task Scheduler 进行了安排,但除了成功之外我一无所获.我什至尝试过 HKLM,并取得了成功.我不清楚你在做什么,但我没有足够的信息来说明它失败的原因.
To expand, I've scheduled this with Task Scheduler running as a service account and as the local SYSTEM account using at.exe
and I got nothing but success. I even tried HKLM, and had success. It's not clear to me what you're doing, but I don't have enough information anymore for why it's failing.