Registry Key extraction and migration

Discussion in 'Python' started by ed, Apr 5, 2004.

  1. ed

    ed Guest

    Hi I want to write a tool to do the following:
    1. extract and display registry keys under abritrary starting point,
    for example:
    source are: HKey_Local_machine\software\old_lcoation or
    HKey_current_user\software\XXX\YYY

    a) then, I can specify where the Keys can be copied and compare the
    new location to the new location. For example: destination are:
    HKEY_local_mahcine\software\New_location.

    b) if the keys are not there flags error message

    how canI do that?
     
    ed, Apr 5, 2004
    #1
    1. Advertising

  2. ed

    Larry Bates Guest

    Ed,

    Take a look at _winreg module. It supports
    everything you are looking for. You were not
    perfectly clear on what keys/values you needed
    so the code below is a guess...

    Larry Bates
    Syscon, Inc.


    import _winreg
    regkey='software\old_lcoation' # Copied your spelling
    value_name="XXX"
    key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, regkey)
    value=_winreg.QueryValueEx(key, value_name)[0]

    new_value="YYY"
    key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, regkey, 0,
    _winreg.KEY_SET_VALUE)
    _winreg.SetValueEx(key, value_name, 0, _winreg.REG_SZ, new_value)


    "ed" <> wrote in message
    news:...
    > Hi I want to write a tool to do the following:
    > 1. extract and display registry keys under abritrary starting point,
    > for example:
    > source are: HKey_Local_machine\software\old_lcoation or
    > HKey_current_user\software\XXX\YYY
    >
    > a) then, I can specify where the Keys can be copied and compare the
    > new location to the new location. For example: destination are:
    > HKEY_local_mahcine\software\New_location.
    >
    > b) if the keys are not there flags error message
    >
    > how canI do that?
     
    Larry Bates, Apr 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HK
    Replies:
    1
    Views:
    3,649
    Cowboy \(Gregory A. Beamer\)
    Apr 1, 2004
  2. Replies:
    0
    Views:
    757
  3. Leny
    Replies:
    3
    Views:
    16,932
    Daniel
    Feb 1, 2005
  4. aekalman
    Replies:
    6
    Views:
    134
    Ben Morrow
    Nov 22, 2004
  5. Boni Satani
    Replies:
    0
    Views:
    169
    Boni Satani
    Jan 9, 2014
Loading...

Share This Page