How can I edit the registry hive for a logged out user on my machine? RRS feed

  • Question

  • This question is part of an Excel VBA application installation and .xla registration requirement.

    The requirement I have is to write a VBScript that handles the following:

    For a logged out user...

    1. REG LOAD HKLM\TempUser [username]
    2. Add a key under HKLM\Software called \Test  (currently doing this manually from regedit while testing)
    3. REG UNLOAD HKLM\TempUser
    4. HKLM\TempUser goes away as expected.
    5. REG LOAD HKLM\TempUser [username]
    6. Use Regedit to check for the key.  It is there under HKLM\Software\Test as expected.
    7. REG UNLOAD HKLM\TempUser to clean things up.

    The problem comes in when the [username] logs in.  The key is not there where I would expect it to be.  It feels like the key that I created is in some NTUSER.DAT somewhere that is not the user's master NTUSER.DAT.  

    When I REG UNLOAD HKLM\TempUser, where is that new key getting stored?  
    Why does it not show up in the HKLM of the user when they log in?

    Thank you for any tips,
    Crew Reynolds

    Wednesday, March 28, 2018 4:44 PM

All replies

  • Hi,

    I notice that the issue is related to VBScript for registry key settings. I move the thread to scripting forum. Hope the scripting guys here can give more suggestion on it.

    Thanks for your understanding.

    Best Regards,
    Winnie Liang

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, April 4, 2018 7:27 AM
  • You need to go back to the books and learn the registry.  HKLM is not a user key.  THe user key is HKCU.  All loaded profile exist in HKU.

    This forum and other technical forums cannot do you homework for you.  If a training course ask you to perform steps then that information must have been given to you.  Go back and review the course.

    What you are asking is not about scripting.  It is about using the system utilities.  Start by also doing a search for examples of the REG program.


    Registry: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724877(v=vs.85).aspx


    • Edited by jrv Wednesday, April 4, 2018 10:43 AM
    Wednesday, April 4, 2018 8:17 AM