Re: Is there a way to programmatically turn on remote registry?

Discussion in 'Python' started by Tim Golden, Oct 24, 2012.

  1. Tim Golden

    Tim Golden Guest

    On 24/10/2012 14:26, Kevin Holleran wrote:
    > On Wed, Oct 24, 2012 at 9:11 AM, Tim Golden <
    > Ok, try specifying the parameter names. (I remember someone having
    > problems before caused by mismatched param order):
    >
    >
    >
    > OK, tried that as well as specifying the parameters directly instead of
    > through variables, with the same result.... I even looked back through
    > my old scripts but I have not used the WMI module in this way... only to
    > do WMI queries...


    Couple of things:

    Does the same thing happen if you run against your own machine?

    What's the result of the code below (which is basically "raw" WMI,
    without the wmi module):

    <code>
    import _winreg as winreg

    import win32com.client

    HKLM = winreg.HKEY_LOCAL_MACHINE
    NICs =
    "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"

    registry = win32com.client.GetObject("winmgmts:/root/default:StdRegProv")
    EnumKey = registry.Methods_("EnumKey")
    params = EnumKey.InParameters.SpawnInstance_()
    params.Properties_.Item("hDefKey").Value = HKLM
    params.Properties_.Item("sSubKeyName").Value = NICs

    OutParameters = registry.ExecMethod_("EnumKey", params)
    print OutParameters.Properties_.Item("ReturnValue")
    print OutParameters.Properties_.Item("sNames")


    </code>

    TJG
     
    Tim Golden, Oct 24, 2012
    #1
    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. Prasad, Ramit
    Replies:
    0
    Views:
    114
    Prasad, Ramit
    Oct 19, 2012
  2. Dennis Lee Bieber
    Replies:
    0
    Views:
    141
    Dennis Lee Bieber
    Oct 20, 2012
  3. Tim Golden
    Replies:
    0
    Views:
    119
    Tim Golden
    Oct 22, 2012
  4. Dennis Lee Bieber
    Replies:
    0
    Views:
    121
    Dennis Lee Bieber
    Oct 22, 2012
  5. Tim Golden
    Replies:
    0
    Views:
    124
    Tim Golden
    Oct 22, 2012
Loading...

Share This Page