Hi I find some scripts in Microsoft MSDN. For example:
HostName="localhost" Dim oRegistry, sBaseKey, iRC, sKey, arSubKeys, sValue Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE On Error Resume Next Set oRegistry = _ GetObject("winmgmts:{ImpersonationLevel=Impersonate}//" & _ HostName & "/root/default:StdRegProv") If Err <> 0 Then wscript.echo "Line 9, " & Err.Number & ", " & _ Err.Description Err.Clear wscript.quit End if sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys) If Err <> 0 Then wscript.echo "Line 23, " & Err.Number & ", " & _ Err.Description Err.Clear wscript.quit End if For Each sKey In arSubKeys iRC = oRegistry.GetStringValue(HKLM, sBaseKey & sKey, _ "DisplayName",sValue) If Err <> 0 Then wscript.echo "Line 32, " & Err.Number & ", " & _ Err.Description Err.Clear wscript.quit End if If iRC <> 0 Then oRegistry.GetStringValue HKLM, sBaseKey & _ sKey, "QuietDisplayName", sValue If Err <> 0 Then wscript.echo "Line 42, " & Err.Number & ", " & _ Err.Description Err.Clear wscript.quit End if End If If sValue <> "" Then wscript.echo sValue End If Next After run the script, I can get Uninstall software list in registry. I try to do it with Python. The code is: from win32com.client import GetObject HKLM = 0x80000002L objRegi = GetObject("winmgmts://./root/default:StdRegProv") sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" iRC = objRegi.EnumKey(HKLM, sBaseKey, sKeys) for sKey in arSubKeys: print sKey After run the code, I get some error message: Traceback (most recent call last): File "D:\steven\itim\t2.py", line 6, in ? iRC = objRegi.EnumKey(HKLM, sBaseKey, sKeys) NameError: name 'sKeys' is not defined I don't know why. Could someone give me a hint? Thanks very much. -- Steven Nien _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython