Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31920
| Date | 2012-10-23 09:07 +0100 |
|---|---|
| From | Tim Golden <mail@timgolden.me.uk> |
| Subject | Re: Is there a way to programmatically turn on remote registry? |
| References | (4 earlier) <CAN4UfGzz81jvkzMByhQ3MAjpdFT_eNy9oRfcwa2j_PGFpoTePw@mail.gmail.com> <508560AC.2080307@timgolden.me.uk> <CAN4UfGxLZXuR8VdzpunASfqudJVyp=Zds36evud-3cAy9cD2xw@mail.gmail.com> <50859EA6.7020602@timgolden.me.uk> <CAN4UfGynWcuq1nW=_9OKfOki-7hENCF6SRN5BtN60wyxFt0U6w@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2652.1350979671.27098.python-list@python.org> (permalink) |
On 22/10/2012 21:01, Kevin Holleran wrote:
> Tim,
>
> I am looking here:
>
> SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF9F6FB0-C999-4D19-BED0-144F77E2A9D6}
>
> Enumerating the keys for a BusType == 5, then grabbing the values of
> DriverDesc, DriverDate, & DriverVersion.
>
> So I am doing this:
[... snip querying uninstallers ...]
I don't have that particular uninstaller key but the code below, using
the wmi module to hide the plumbing, queries all the installers and
should give you enough of an idea, hopefully. For brevilty, I've only
bothered with extracting string values; it would be easy to extract
other datatypes.
To perform the same query on another computer, just pass the other
computer name (or IP address) as the first parameter to the wmi.WMI call
(or use the named param "computer").
<code>
import _winreg as winreg
import wmi
HKLM = winreg.HKEY_LOCAL_MACHINE
UNINSTALLERS = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
registry = wmi.WMI(namespace="default").StdRegProv
_, names = registry.EnumKey(HKLM, UNINSTALLERS)
for name in names:
print name
uninstaller = UNINSTALLERS + "\\" + name
_, value_names, value_types = registry.EnumValues(HKLM, uninstaller)
for value_name, value_type in zip(value_names, value_types):
if value_type == winreg.REG_SZ:
_, value = registry.GetStringValue(
HKLM, uninstaller, value_name
)
else:
value = "(Non-string value)"
print u" ", value_name, u"=>", value
</code>
TJG
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Is there a way to programmatically turn on remote registry? Tim Golden <mail@timgolden.me.uk> - 2012-10-23 09:07 +0100
csiph-web