Changing Remote Registry

Tim Golden mail at timgolden.me.uk
Fri Aug 7 14:08:22 EDT 2009


Kevin Holleran wrote:
> Long story short, I am using _winreg to do this.
> 
> hKey = _winreg.OpenKey (keyPath, path, 0, _winreg.KEY_SET_VALUE)
> value,type = _winreg.QueryValueEx(hKey, item)
> if (value == wrongValue):
>        _winreg.SetValue(hKey,'',_winreg.REG_SZ,correctValue)
> 
> 
> When I do this I receive the error:
> 
> _winreg.SetValue WindowsError: [Error 5] Access Denied

As an alternative, try using WMI instead. You'll have to look up the docs
a bit, but to get you started:

<code>
import wmi

reg = wmi.WMI ("remote-machine", namespace="default").StdRegProv

print reg.methods.keys ()

</code>

TJG



More information about the Python-list mailing list