Get OS name

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Apr 15 10:06:57 EDT 2005


[rbt]
| 
| codecraig wrote:
| > How can I get the OS Name, such as "Windows XP Pro".  I 
| know I can do
| > 
| > sys.getwindowsversion but that doesnt return a nice Windows XP Pro
| > string.
| > 
| > and os.name gives "nt"
| > 
| > thanks.
| > 
| 
| Read the docs... sys.getwindowsversion() should do the trick. AFAIK, 
| there is no way to differentiate between XP Home and Pro...

I'm no expert on this (I don't even use XP) but the WMI
Win32_OperatingSystem class seems to give a useful string
here:

<code>
import wmi

c = wmi.WMI ()
for os in c.Win32_OperatingSystem ():
  print os.Caption

</code>

gives "Microsoft Windows XP Professional" and 
"Microsoft Windows 2000 Professional" on a couple
of machines I tried.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list