c.Win32_OperatingSystem question.

Discussion in 'Python' started by bryan rasmussen, Feb 28, 2009.

  1. 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, Feb 28, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean
    Replies:
    1
    Views:
    597
    Cowboy \(Gregory A. Beamer\)
    Oct 20, 2003
  2. =?Utf-8?B?UnlhbiBTbWl0aA==?=

    Quick Question - Newby Question

    =?Utf-8?B?UnlhbiBTbWl0aA==?=, Feb 14, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    662
    Iain Norman
    Feb 16, 2005
  3. =?Utf-8?B?YW5kcmV3MDA3?=

    question row filter (more of sql query question)

    =?Utf-8?B?YW5kcmV3MDA3?=, Oct 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    950
    Scott Allen
    Oct 6, 2005
  4. Philip Meyer
    Replies:
    0
    Views:
    426
    Philip Meyer
    Nov 30, 2003
  5. Bit Byte
    Replies:
    1
    Views:
    854
    Teemu Keiski
    Jan 28, 2007
Loading...

Share This Page