We have a couple of workstations in various sites. Some are using Windows XP Professional and some are using Windows 7 Professional/Enterprise.
All of these workstations are:
1) not in a domain;
2) having default logon user in "Users" group with no password set (i.e. when the computer starts up, it will go to that user directly); and
3) remote desktop are not enabled for security reasons.
Now, I would like to write a single DOS batch script and give the script to the staff at each site to update an entry under HKCU key for the default logon user for each workstation at their site such that they can perform another specific task (not related to this question) on each workstation.
However, the default logon user have a different user name for each of the public workstation, and the entry cannot be updated by the default logon user by default.
Therefore, my idea is to logon to the local administrator account on each workstation and run the script to import the HKCU key of the default logon user and update the specific entry.
The following is what I got so far.
reg load HKLM\TempHive %NTUSERPATH%
reg add <Key_Name> /v <Value_Name> /t REG_DWORD /d 0 /f
However, I have no idea on getting the path to the ntuser.dat of the default logon user.
Besides, as shown in the given code, it is working for Windows 7 only. I know that for Windows XP, the path is under C:\Documents and Settings. Is it possible to set a single value for the NTUSRPATH that works for both Windows XP and Windows 7? If no, how can I distinguish the current OS to be Windows XP and Windows 7?