PremCab
asked on
Reg Load batch file problem
Hey
I am having a problem creating a batch file that loads an NTUSER.dat file into HKU in the registry, then exports a key from the NTUSER.dat file into a .reg file.
Can someone have a look at the code below and tell me where I am going wrong?
I plan to push it out using our software delivery program, but I need to get the batch file working first. We are running a windows XP based environment.
Thanks
I am having a problem creating a batch file that loads an NTUSER.dat file into HKU in the registry, then exports a key from the NTUSER.dat file into a .reg file.
Can someone have a look at the code below and tell me where I am going wrong?
I plan to push it out using our software delivery program, but I need to get the batch file working first. We are running a windows XP based environment.
Thanks
REG LOAD HKU\NTUSER "c:\Documents and Settings\%username\ntuser.dat"
REG EXPORT HKU\NTUSER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging SubSystem\Profiles" "C:\Documents and Settings\%username%\Desktop\trial.reg"
REG UNLOAD HKU\NTUSER
ASKER
Sorry Does the same thing as HKU. I have tried both options. It seems as there is something wrong with the REG LOAD line because when I place a pause command after it, it doesn't pause. A command prompt screen just flashes on the screen
When you run this batch %username will be the name of the logged in user. Because this user is logged in his profile is in use, and cannot be loaded again. You will find his profile in HKEY_Current_user
REG EXPORT HKCU\Software\Microsoft\Wi ndows NT\CurrentVersion\Windows Messaging SubSystem\Profiles" "C:\Documents and Settings\%username%\Deskto p\trial.re g"
REG EXPORT HKCU\Software\Microsoft\Wi
Your software delivery program will probably run with the different userid other than the actual user. You might want to put this into your AD logon script or GPO User Logon Script.
I don't like using
"C:\Documents and Settings\%username%\Deskto p\trial.re g" because a user could have a stuck profile and the actual folder might be something like %username%.%userdomain% or %username%.001 or %username%.002
I don't like using
"C:\Documents and Settings\%username%\Deskto
REG EXPORT HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging SubSystem\Profiles" "%userprofile%\Desktop\trial.reg"
Opps the export will need quotes too.
REG EXPORT "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging SubSystem\Profiles" "%userprofile%\Desktop\trial.reg"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cant believe I missed the nd qoute on %username...
Any update?
Any update?
ASKER
Thanks for all your help.
We may end up running it via login scripts, because of deroode's comment. I didn't even click that it wouldn't work because the user is logged in still. If only the keys under HKU were easy to distiguish between without actually opening the key.
Thank you again for all your help
We may end up running it via login scripts, because of deroode's comment. I didn't even click that it wouldn't work because the user is logged in still. If only the keys under HKU were easy to distiguish between without actually opening the key.
Thank you again for all your help
ASKER
Thanks for pointing out the obvious, which I was yet to realise.
It's always the most obvious and simplist answer which you tend to skim over.
It's always the most obvious and simplist answer which you tend to skim over.
derode:
I do agree with you hku is the only way to find someone else's hive when they are logged in. Typically something like SMS will run even if a user is not logged on.
BTW:
HKU\{SID}\Software\Microso ft\Windows \CurrentVe rsion\Expl orer
Logon User Name
Is what I use to find out who this particular SID belongs to.
I do agree with you hku is the only way to find someone else's hive when they are logged in. Typically something like SMS will run even if a user is not logged on.
BTW:
HKU\{SID}\Software\Microso
Logon User Name
Is what I use to find out who this particular SID belongs to.
REG EXPORT HKLM\NTUSER\Software\Micro
REG UNLOAD HKLM\NTUSER