在“服务"提供商中,Reg导出的工作方式有所不同.和“管理员" [英] Reg export works differently among "service" and "administrator"
问题描述
我在下面的脚本中尝试了"reg export"命令
I tried "reg export" command in the script below
reg export "HKEY_CURRENT_USER\Control Panel\Desktop" xxx.reg
,但是当管理员或服务使用脚本时,脚本会执行不同的操作. (当该服务正常工作时(用户为"nt Authority \ SYSTEM"),xxx.reg的注册表比管理员少.)
but the script work different action when it is worked by administrator or service. (When it is worked service(user is "nt authority\SYSTEM"), xxx.reg's registry is few than by admin)
我想知道如何通过服务"和管理员"获得相同的注册表...
I want to know how to get same registry by both "service" and "admin"...
推荐答案
这是因为管理员帐户和服务帐户是具有不同用户配置单元的不同帐户. HKEY_CURRENT_USER
仅仅是HKEY_USERS\S-1-5-21-...
的快捷方式,其中S-1-5-21-...
是当前用户的SID.如果要在服务帐户下运行的任务从另一个用户的配置单元中导出数据,则需要先将该配置单元加载到注册表中,然后再将其卸载:
That's because Administrator and service account are different accounts with different user hives. HKEY_CURRENT_USER
is merely a shortcut to HKEY_USERS\S-1-5-21-...
where S-1-5-21-...
is the SID of the current user. If you want a task running under a service account to export data from another user's hive, you need to load that hive into the registry first and unload it afterwards:
reg load HKU\Temp C:\Users\username\ntuser.dat
reg export "HKU\Temp\Control Panel\Desktop" xxx.reg
reg unload HKU\Temp
您可能还需要调整个人资料文件夹的权限,因为默认情况下,只有个人资料所有者(即相应的用户)才能访问个人资料.
You may also need to adjust permissions on the profile folders, because by default only the profile owner (i.e. the respective user) has access to a profile.
这篇关于在“服务"提供商中,Reg导出的工作方式有所不同.和“管理员"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!