Entry
Getting platform information on Windows NT
Jul 5th, 2000 10:02
Nathan Wallace, Hans Nowak, Snippet 247, Karl Putland
"""
Packages: operating_systems.windows
"""
#Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
#Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
#IDLE 0.5 -- press F1 for help
from win32api import RegOpenKeyEx, RegQueryValueEx
from win32con import HKEY_LOCAL_MACHINE
from win32api import RegEnumValue
key = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
r'SOFTWARE\Microsoft\Windows NT\CurrentVersion')
i=0
while 1:
try:
str,obj,type = RegEnumValue(key,i)
print str,obj,type
i=i+1
except:
break
# sample output:
"""
SoftwareType SYSTEM 1
InstallDate 934559805 4
RegisteredOwner Administrator 1
RegisteredOrganization wisen.com, Inc. 1
CurrentBuild 1.511.1 () (Obsolete data - do not use) 1
CurrentVersion 4.0 1
CurrentBuildNumber 1381 1
CurrentType Uniprocessor Free 1
SystemRoot C:\WINNT 1
SourcePath C:\I386\ 1
PathName C:\WINNT 1
ProductId 13299OEM004225197031 1
CSDVersion Service Pack 4 1
Plus! VersionNumber IE 5 5.00.2314.1003 1
"""