[Tutor] Window Registry Access

Alan Gauld alan.gauld at freenet.co.uk
Thu Oct 28 09:54:32 CEST 2004


> I am attempting to read information from a remote registry using
Python,

I'd recommend using WSH for this. You can access the WSH objects
using the Python win extensions as usual.

Here is some VBSCript sample code, converting to Python should
be easy ...but I'm in a hurry :-(

Dim wshSHell
Set wshShell = CreateObject("WScript.Shell")

' Find the Windows OS version
MsgBox
wshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion")
' CReate a new context menu item for Notepad
wshShell.RegWrite("HKCR\*\Shell\Notepad", "View with Notepad",
"REG_SZ")
wshShell.RegWrite("HKCR\*\Shell\Notepad\Command","%WINDIR%\notepad.exe
%","REG_EXPAND_SZ")

Its possible to do edits over the network too by giving a network
path...
There are also networking objects within WSH...

Alan G.



More information about the Tutor mailing list