Is there a way to programmatically turn on remote registry?

Tim Golden mail at timgolden.me.uk
Wed Oct 24 10:12:50 EDT 2012


On 24/10/2012 14:26, Kevin Holleran wrote:
> On Wed, Oct 24, 2012 at 9:11 AM, Tim Golden <mail at timgolden.me.uk
>     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




More information about the Python-list mailing list