Is there a way to programmatically turn on remote registry?

Kevin Holleran kdawg44 at gmail.com
Wed Oct 24 08:36:21 EDT 2012


On Wed, Oct 24, 2012 at 7:51 AM, Tim Golden <mail at timgolden.me.uk> wrote:

> On 24/10/2012 12:40, Kevin Holleran wrote:> Here is the full traceback:
> >
> Could you confirm what version of Windows is running on the remote
> machine? Also, could you show the output of the following, please:
>
> <code>
> import wmi
>
> host = "<whatever>" # pick one
>
> print wmi.WMI(host, namespace="default").StdRegProv
>
> </code>
>
>
> TJG
>

The machine I am testing from is Windows7, the machine I will run this from
is running an exe generated from py2exe and is running Windows 2008 server.

The machines I am targeting are all Windows 2003 Server machines, though I
am hoping to also expand and use this script on a number of Windows XP
devices (which shouldn't be a problem...)

Here is the output as you requested.  Again thanks for your time & help.  I
hate monopolizing one person's time so much....


>python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wmi
>>> host=""#removed from ouput....
>>> print wmi.WMI(host,namespace="default").StdRegProv
[Locale(1033), dynamic: ToInstance, provider("RegProv")]
class StdRegProv
{
        [implemented, static] uint32 CreateKey([IN] uint32 hDefKey =
2147483650,
 [IN] string sSubKeyName);
        [implemented, static] uint32 DeleteKey([IN] uint32 hDefKey =
2147483650,
 [IN] string sSubKeyName);
        [implemented, static] uint32 EnumKey([IN] uint32 hDefKey =
2147483650, [
IN] string sSubKeyName, [out] string sNames[]);
        [implemented, static] uint32 EnumValues([IN] uint32 hDefKey =
2147483650
, [IN] string sSubKeyName, [out] string sNames[], [out] sint32 Types[]);
        [implemented, static] uint32 DeleteValue([IN] uint32 hDefKey =
214748365
0, [IN] string sSubKeyName, [in] string sValueName);
        [implemented, static] uint32 SetDWORDValue([IN] uint32 hDefKey =
2147483
650, [IN] string sSubKeyName, [in] string sValueName, [in] uint32 uValue =
3);
        [implemented, static] uint32 GetDWORDValue([IN] uint32 hDefKey =
2147483
650, [IN] string sSubKeyName, [in] string sValueName, [out] uint32 uValue);
        [implemented, static] uint32 SetStringValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [in] string sValue =
"hel
lo");
        [implemented, static] uint32 GetStringValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [out] string sValue);
        [implemented, static] uint32 SetMultiStringValue([IN] uint32
hDefKey = 2
147483650, [IN] string sSubKeyName, [in] string sValueName, [in] string
sValue[]
 = {"hello", "there"});
        [implemented, static] uint32 GetMultiStringValue([IN] uint32
hDefKey = 2
147483650, [IN] string sSubKeyName, [in] string sValueName, [out] string
sValue[
]);
        [implemented, static] uint32 SetExpandedStringValue([IN] uint32
hDefKey
= 2147483650, [IN] string sSubKeyName, [in] string sValueName, [in] string
sValu
e = "%path%");
        [implemented, static] uint32 GetExpandedStringValue([IN] uint32
hDefKey
= 2147483650, [IN] string sSubKeyName, [in] string sValueName, [out] string
sVal
ue);
        [implemented, static] uint32 SetBinaryValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [in] uint8 uValue[]
= {1,
 2});
        [implemented, static] uint32 GetBinaryValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [out] uint8
uValue[]);
        [implemented, static] uint32 CheckAccess([IN] uint32 hDefKey =
214748365
0, [IN] string sSubKeyName, [in] uint32 uRequired = 3, [out] boolean
bGranted);
};

>>> registry=wmi.WMI(host,namespace="default").StdRegProv
>>> import _winreg as winreg
>>> HKLM = winreg.HKEY_LOCAL_MACHINE
>>> NICs =
"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-
08002bE10318}"
>>> _, names=registry.EnumKey(HKLM,NICs)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\wmi.py", line 431, in __call__
    handle_com_error ()
  File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
    raise klass (com_error=err)
wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception
occurred.', (0,
 u'SWbemProperty', u'Type mismatch ', None, 0, -2147217403), None)>
>>> print registry.EnumKey(HKLM,NICs)


Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121024/b369c751/attachment.html>


More information about the Python-list mailing list