Kevin Holleran wrote:
On Fri, Aug 7, 2009 at 10:46 AM, MRAB <pyt...@mrabarnett.plus.com
<mailto:pyt...@mrabarnett.plus.com>> wrote:
Kevin Holleran wrote:
On Fri, Aug 7, 2009 at 10:11 AM, MRAB
<pyt...@mrabarnett.plus.com <mailto:pyt...@mrabarnett.plus.com>
<mailto:pyt...@mrabarnett.plus.com
<mailto:pyt...@mrabarnett.plus.com>>> wrote:
Kevin Holleran wrote:
Good morning,
I fear the answer to this is that I just cannot do this....
I wrote a python script that goes out to a bunch of remote
machines and queries the registry for some values.
Effectively,
there have been some software upgrades that have been done as
the need arose but we need to do them across the organization
now. There are three, and the script checks all three and
returns the values. One of these just needs to be a registry
change as it is a client server application that the
server was
upgraded and the clients need a change to a registry
value to work.
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)
Hmm. If you're querying with (hKey, item), shouldn't you also be setting
with (hKey, item), not (hKey,'')?
When I do this I receive the error:
_winreg.SetValue WindowsError: [Error 5] Access Denied
I am running this from my machine as a domain admin,
connecting
to the remote machine which is also on the domain.
I am connecting to the remote registry with:
keyPath = _winreg.ConnectRegistry(r"\\" +
ipAddress,_winreg.HKEY_LOCAL_MACHINE)
Thanks for any help.
What is 'ipAddress'? Is it an actual IP address? The
documentation says
it should be the computer name.
-- http://mail.python.org/mailman/listinfo/python-list
Thanks for the response. From my experience that does not
matter. It is an actual IP address. I can connect to the
registry fine, its just the writing. I read that value and
other values. It errors on the _winreg.KEY_SET_VALUE. I am
wondering if Windows just will not let the registry be changed
remotely in this way or if there is something else I have to do.
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, that line is correct, I was removing specific information
relevant to our infrastructure. That is the valuename. The error I am
getting is:
Traceback (most recent call last):
File "script.py", line 53, in <module>
value,type = _winreg.QueryValueEx(hKey,item)
WindowsError: [Error 5] Access is denied
But the real error is here I believe:
hKey = _winreg.OpenKey (keyPath, path, 0, _winreg.KEY_SET_VALUE)
When I just do a:
hKey = _winreg.OpenKey (keyPath, path, 0, _winreg.KEY_READ)
I receive no errors.
Thanks.
If it's complaining _as soon as_ you request write permission then I'd
say that was a permissions problem, not an error! :-)
--
http://mail.python.org/mailman/listinfo/python-list