How to read data from a remote Windows registry using Python

Thursday, March 17th, 2011

It is easy to connect to a remote Windows machine and retrieve information from the registry using the Python Windows registry access module _winreg

from _winreg import *

reg = ConnectRegistry('computer123222', HKEY_LOCAL_MACHINE)
key = OpenKey(reg, 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate',0,KEY_READ)
value = QueryValueEx(key, 'SusClientId')

ConnectRegistry() allows you to specify the remote computer and one of the HKEY constants like HKEY_LOCAL_MACHINE or HKEY_USERS.

OpenKey() specifies the remote registry as the location of the hive), the sub key, an integer of 0 (it  must be 0!) followed by the registry key access rights.

Problems installing Microsoft SQL Server Express 2005

Monday, January 5th, 2009

Hi all,
I had to install SQL Server Express 2005 edition on my works laptop so I could develop a small database driven application.
I have Visual Studio 2005 already installed and thought installing SQL express would be a simple process, oh no..,…

First attempt – it installed the following without a hitch:

  • SQL Setup Support Files
  • SQL Native Client
  • SQL VSS Writer

but then failed miserably on the SQL Server Database Services, checking through the log files showed nothing out of the ordinary. The summary file stated that the install had been a success, though the installer then wanted to report a fail back to Microsoft headquarters.

So time to start digging, fire up Google and find out who else has had a similar problem, quite a few by the looks of it.

My first attempt at a remedy was to use add/remove programs to remove all traces of the botched install. Then use regedit to remove the following keys (if present) /HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL (xxxx) where (xxx) is anything after SQL..

After a reboot I tried another install – same error message.

After many variations of the above I then looked slightly further afield, at the MSXML6 parser, this is a pre-requisite of SQL Server Express 2005, and I had downloaded it from the Microsoft download page MSXML6.exe Parser and attempted to install it.

It failed stating that the version installed was newer than the version I was attempting to install, but after more headaches etc I looked at the dlls msxml6.dll and msxml6r.dll and noted that they were not newer.
I tried to remove MSXML6 parser using the add/remove programs – it replied that it couldn’t as it wasn’t installed!
But the .dlls could be seen – and they were registered?! So I unregistered them both using regsvr32 /u and tried again to remove the app using add/remove programs. No luck.

I then downloaded Windows Installer Clean Up tool and scrolled down to find the rouge MSXML6.
Highlighted the app – clicked ‘Remove’, then attempted an install of msxml6.exe, it didn’t complain about any previous version (onto a winner?) and installed correctly.
I then, tentatively, tried to install the MS SQL Express 2005 – and after an age it installed fully…

Wahoo… we have a winner.

All I have to do now is write the application… and I am more of a MySQL man myself.

;o)

Adam

Microsoft Office 2007 to Support ODF

Wednesday, May 21st, 2008

I just read this on Slashdot and wondered what people thought of this seemingly bizarre move from MS?

After campaigning for OOXML so vigorously, MS have now announced that they will be issuing an update to Office 2007 to add support for OASIS ODF 1.1.

This won’t be available as the default format for saving, but even so – making support available for ODF and not supporting OOXML (that won’t come until a future version) must fatally damage OOXML as a standard.

Hopefully the delay in OOXML support and the emergance of ODF support as standard in an MS Office suite will herald new support by the public sector for the ODF format.

Who knows, the next time you visit your favorite government website you might be able to grab a copy of taxreturn.odt