Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - c.Win32_OperatingSystem question.

 
Thread Tools Search this Thread
Old 02-28-2009, 05:38 PM   #1
Default c.Win32_OperatingSystem question.


Maybe there's a more specific list I should ask this question on but I
don't know what it is. I'm using Tim Golden's wmi stuff, and putting
my output into an XML document.

I have the following bit of code


root = et.Element("locations")
ComputerInfo = et.SubElement(root, "ComputerInfo")
ComputerName = et.SubElement(ComputerInfo,"ComputerName")
ComputerDomain = et.SubElement(ComputerInfo,"Domain")

location = et.SubElement(root, "location")
locationpath = et.SubElement(location, "locationpath")
locationtype = et.SubElement(location, "locationtype")
currenttime = et.SubElement(location,"time")

currenttimeZone = et.SubElement(ComputerInfo,"timeZone")
BootDevice = et.SubElement(ComputerInfo,"BootDevice")
BuildNumber = et.SubElement(ComputerInfo,"BuildNumber")
BuildType = et.SubElement(ComputerInfo,"BuildType")
Caption = et.SubElement(ComputerInfo,"Caption")
CodeSet = et.SubElement(ComputerInfo,"CodeSet")
CountryCode = et.SubElement(ComputerInfo,"CountryCode")
Description = et.SubElement(ComputerInfo,"ComputerDescription")
FreePhysicalMemory = et.SubElement(ComputerInfo,"FreeMemory")
LocalDateTime = et.SubElement(ComputerInfo,"LocalDateTime")
Locale = et.SubElement(ComputerInfo,"Locale")
Manufacturer = et.SubElement(ComputerInfo,"Manufacturer")
Organization = et.SubElement(ComputerInfo,"ComputerOrganization")


OSType = et.SubElement(ComputerInfo,"OperatingSystem")
WindowsDirectory = et.SubElement(ComputerInfo,"WindowsDirectory")

# print "ok"
# time.sleep(3)


for oper in c.Win32_OperatingSystem():
# print "here"
# time.sleep(3)
ComputerName.text = str(oper.Name)
ComputerDomain.text = str(oper.Domain)
currenttimeZone.text = str(oper.CurrentTimeZone)
try:
currenttime.text = str(datetime.datetime.utcnow())
BootDevice.text = str(oper.BootDevice)
BuildNumber = et.SubElement(oper.BuildNumber)
BuildType.text = str(oper.BuildType)
Caption.text = str(oper.Caption)
CodeSet.text = str(oper.CodeSet)
CountryCode.text = str(oper.CountryCode)
Description.text = str(oper.ComputerDescription)
FreePhysicalMemory.text = str(oper.FreeMemory)
LocalDateTime.text = str(oper.LocalDateTime)
Locale.text = str(oper.Locale)
Manufacturer.text = str(oper.Manufacturer)
Organization.text = str(oper.ComputerOrganization)


OSType.text = str(oper.OperatingSystem)
WindowsDirectory.text = str(oper.WindowsDirectory)


At the end of that thhe only text node thaht comes out is
ComputerName, WMI is running - Am I using the wrong names for things
here? When I try to get the same values using WScript and WQL to
extract from Win32_OperatingSystem I get all the values.

Best Regards,
Bryan Rasmussen


bryan rasmussen
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Dial-up Modem Question w_tom A+ Certification 0 09-18-2005 09:12 PM
"Installing two drives" question - what next? Jim A+ Certification 12 08-07-2005 01:19 PM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good God DVD Video 3 04-25-2005 04:19 PM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good Filthy Mcnasty DVD Video 0 04-25-2005 04:29 AM
Re: Safe Mode Question (A+ question) Gordon Findlay A+ Certification 0 06-16-2004 10:48 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46