I found a way to get the usercode. Below is my batchfile to get it. It only works if you are the only user on the pc because then there will be only one S-1-5-21 entry in the registry key below. To work on a multi-user pc more coding has to be done but that is a bit more difficult.
REG EXPORT "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfileList.reg TYPE ProfileList.reg > ProfileList.txt DEL ProfileList.reg FINDSTR /R .*S-1-5-21.* ProfileList.txt > MyUsercode.txt DEL ProfileList.txt FOR /F "USEBACKQ TOKENS=1,2 DELIMS==" %%I IN (MyUsercode.txt) DO ( SET Usercode=%%I ) DEL MyUsercode.txt
SET Usercode=%Usercode:~77,-1%
Just add 1 or more REG ADD lines, using the Usercode variable, to the batchfile and you'r done.
compability mode via command line
in Unattended Windows 2000/XP/2003
Posted
I found a way to get the usercode. Below is my batchfile to get it. It only works if you are the only user on the pc because then there will be only one S-1-5-21 entry in the registry key below. To work on a multi-user pc more coding has to be done but that is a bit more difficult.
Just add 1 or more REG ADD lines, using the Usercode variable, to the batchfile and you'r done.