Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'parameter': 0.07; 'cc:addr:python-list': 0.10; '"\\\\"': 0.16; '...]': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'param': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'registry': 0.16; 'tim,': 0.16; 'tjg': 0.16; 'wmi': 0.16; 'string': 0.17; 'wrote:': 0.17; '(or': 0.18; 'module': 0.19; 'import': 0.21; 'keys': 0.22; 'cc:2**0': 0.23; 'kevin': 0.23; 'this:': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'skip:" 50': 0.27; 'address)': 0.29; 'idea,': 0.29; 'query': 0.30; 'code': 0.31; 'print': 0.32; 'extract': 0.33; 'received:192.168.100': 0.33; 'another': 0.33; 'doing': 0.35; 'subject:?': 0.35; 'but': 0.36; 'should': 0.36; 'enough': 0.36; 'skip:z 10': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'below,': 0.60; 'easy': 0.60; 'skip:u 10': 0.60; 'skip:w 30': 0.61; 'first': 0.61; 'here:': 0.62; 'bothered': 0.65; 'subject:there': 0.65; 'from:addr:mail': 0.71; 'grabbing': 0.84; 'to:none': 0.93 Date: Tue, 23 Oct 2012 09:07:46 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 CC: python-list@python.org Subject: Re: Is there a way to programmatically turn on remote registry? References: <5B80DD153D7D744689F57F4FB69AF4741671F47B@SCACMX008.exchad.jpmchase.net> <508560AC.2080307@timgolden.me.uk> <50859EA6.7020602@timgolden.me.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350979671 news.xs4all.nl 6927 [2001:888:2000:d::a6]:52490 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31920 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"). 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 TJG