none
WMI script failing on XPe RRS feed

  • Question

  • I posted a question about WMI earlier today but now I have found a more urgent problem.  My system is XPe, command shell, minlogon.  I need to run a vbs/wmi script using cscript.  I am concerned about the 57MB that the WMI macro component adds to my image but as a test I built a system with that component.  All dependencies were resolved and this was the only change to my XPe image that works well.  To eliminate my script writing skill as an issue, I found the following simple script on MSDN:

    On Error Resume Next
    ' Connect to WMI and obtain instances of Win32_OperatingSystem
    For Each objOS in GetObject( _
        "winmgmts:").InstancesOf ("Win32_OperatingSystem")

    WScript.Echo "Name = " & objOS.Caption _
        & "Version = " & objOS.Version &VBCR _
        & "Registered User = " & objOS.RegisteredUser &VBCR _
        & "Manufacturer = " & objOS.Manufacturer
    Next

    if Err <> 0 Then
        WScript.Echo Err.Description
        Err.Clear
    End if


    When I execute this script on XP desktop I get the expected result.  When I execute it on my newly built XPe system I get an error message saying "... not a collection."  Why is WMI failing in my system?  Might there be a "hidden dependency" that Dependency Check did not find?

     

    Thursday, July 8, 2010 4:37 PM

All replies

  • There are several components that add capability to WMI. I know you want a small footprint, did you add the Windows Management Instrumentation Technologies macro component to the image?

    -Sean

     

     

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Thursday, July 8, 2010 8:55 PM
    Moderator
  • Yes - I added that macro component.  It and all its dependencies added 57MB to my footprint.  That's bad enough but the result was that I still couldn't successfully execute a trivial WMI script.
    Friday, July 9, 2010 3:57 AM
  • What version of XPe are you using WES2009, XPE SP3, XPE FP2007+UR1?

    -Sean

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Friday, July 9, 2010 4:32 AM
    Moderator
  • XPE FP2007+UR1.  Have been using XPe for about 5 years for the same task so my basic configuration has not changed much in years, however I now have an interest in executing a WMI script at startup.

     

    Friday, July 9, 2010 1:04 PM
  • One of the older vesions of XPe required a change in Target Designer. I just ran your script in a Full version of XPE / WES2009, and it ran perfectly.

    Startup - have you tried the script after the OS has completely booted?

    There are different components that add different WMI support:

    Windows Script Engines
    Active Directory Service Interface (ADSI) Core
    WMI ADSI Extensions
    Active Directory Service Interface (ADSI) LDAP Provider
    Active Directory Service Interface (ADSI) Netware 3.x Provider
    Active Directory Service Interface (ADSI) Novel Directory Service Provider
    Active Directory Service Interface (ADSI) OLEDB Provider
    Active Directory Service Interface (ADSI) Windows NT Provider
    Collaborative Data Objects (CDO)
    WMI Scripting
    WMI Core
    Terminal Service WMI Provider
    Windows Product Activation WMI Provider
    WMI Consumers
    WMI Correlation
    WMI DS Provider
    WMI Extensions to WDM Property Page Provider
    WMI Extensions to WDM Service
    WMI Filter
    WMI SNMP Provider
    WMI View Provider
    WMI Win32 Provider
    WMI Windows Installer Provider

     

    -Sean

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Saturday, July 10, 2010 4:30 PM
    Moderator
  • Yes, I tried the script after the OS completely started up.  Same result.

    I've used XPe for 5 years but this kind of thing is why big doubts keep arising.  I added 57 MB to my configuration by including "Windows Management Instrumentation Technologies" and I've still failed to execute a trivial WMI script.  Perhaps including some combination of the 23 components in Sean's list will solve the problem but which ones and how much larger will my configuration get?  I actually can't spare 57 or more Mbytes plus whatever additional memory will be used by the new services that get installed.  My system is RBS/Ramdisk so services that get installed and started permanently eat memory in both the file system and execution RAM (there's no page file).

    I've re-examined my task and I've found a way to accomplish it using library calls in my application so I'm temporarily giving up on WMI.  Some day in the future I may really need WMI scripting but I hope not because apparently not much thought has been given to factoring it in a way that makes sense for an embedded system.

    Thanks Sean.  My comments are directed at the structure of XPe, not any individual.

    LW

    Monday, July 12, 2010 7:12 PM