Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Get OS name

Thread Tools

RE: Get OS name

Tim Golden
Posts: n/a
| 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 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

import wmi

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


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


__________________________________________________ ______________________
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:
__________________________________________________ ______________________
Reply With Quote
Posts: n/a
where can I get wmi module, it doesnt come with Python right?


Reply With Quote
Grant Edwards
Posts: n/a
On 2005-04-15, codecraig <(E-Mail Removed)> wrote:

> where can I get wmi module, it doesnt come with Python right?

Grant Edwards grante Yow! ... I want a COLOR
at T.V. and a VIBRATING BED!!!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a variable name to a hash to name is part of the variable name Bobby Chamness Perl 2 04-22-2007 09:54 PM
print("my name is {name}, and {age}-year old {gender}", name, age, gender); =?iso-8859-1?B?bW9vcJk=?= Java 7 01-02-2006 04:39 PM
IE name="name" & property bug Java script Dude Javascript 5 06-30-2004 03:07 AM
name = name.substring(0, name.lastIndexOf('.')); Help please Jack-2 Javascript 3 12-24-2003 04:39 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM