none
Where is the Forum for WMI ? 0X80041003 permissions fail RRS feed

  • Question

  • Hi

    The answer to my problem is probably something so bleeding obvious that it's not documented anywhere !

    Basically, I want to read the hard disk temperature on a local pc, and have it available for graphing programmatically (in VBscript ?).

    Open Hardware Monitor does it, so I know it's possible.
    http://openhardwaremonitor.org/
    (I thought OHM was querying WMI, but it seems to write data to WMI instead - I'll look into that next, but still would like an answer here ! I guess I could even reverse-engineer OHM from source ...)
    OHM publishes all sensor data to WMI

    I believe Win32_TemperatureProbe class is useless.
    "current implementations of WMI do not populate the CurrentReading property"
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394493(v=vs.85).aspx
    I won't hold my breath waiting for it to be implemented !
    Or is that page out of date ?

    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI") 
    Set colItems = objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData",,48) 

    Seems to return a collection object OK.

    For Each objItem in colItems 

    gives Error 0x80041003.

    I did not invent the above code, it comes from WMICodeCreator
    http://www.microsoft.com/en-us/download/details.aspx?id=8572

    WMICodeCreator itself lets me navigate to '\root\WMI' then 'MSStorageDriver_ATAPISmartData' then 'VendorSpecific'
    byte number 115 is the one that holds the temperature
    However, if I click 'Search for Property Values', I get 'Searching' ... 'Access Denied'

    WbemTest.exe
    also gives me 0x80041003 when I click on 'Instances' of MSStorageDriver_ATAPISmartData
       Number: 0x80041003
       Facility: WMI
       Description: Access denied

    Binging finds 'Set Permissions in WMI Control'.
    Eventually I think I tracked that down:
    My Computer : Right-click : Manage
    Services and Applications : WMI Control : Right-click : Properties
    'Security Tab' : Root : WMI : 'Security' button
    Group : Administrators : 'Advanced' button
    'Permissions' Tab : Administrators : 'View' button
    All 'Permissions' boxes are checked, but all are greyed - Inherited permissions, not explicitly set on this object, I guess ?
    Boxes are not clickable, so maybe grey = disabled.

    Yes, I am a member of Group : Administrators.

    I get the same results on 2 laptops : Window 7 Premium, and Windows 8 Consumer Preview.

    Even Scriptomatic2 gives 0x8004103 on load.
    http://www.microsoft.com/en-us/download/details.aspx?id=12028

    Ah!
    http://www.insidethe.com/blog/2009/12/how-to-launch-a-wsh-vbscript-as-administrator-in-windows-7-and-vista/
    Seems to help !

    Or
    http://www.mydigitallife.info/how-to-add-run-as-administrator-for-vbs-vb-script-and-js-javascript-files/
    adds 'Run as Admin' to the context right-click menu !

    OK, so I was stupid enough to assume that an Administrator running a script would be running the script as an Administrator.
    Noob error.

    OK if I leave this here ? It has wasted two days of my time, so I hope someone else finds it useful.

    Eric

    PS Would it be too much to ask that Scriptomatic and WMICodeCreator be updated so that they work 'out of the box' ? Maybe with a 'Safe Mode' and 'Admin Mode' ?

    PPS Credit is also due to Alan Kaplan - Scriptomatic on Windows 7 Solved - linking 80041003 and Scriptomatic.

    Friday, May 25, 2012 10:09 AM

Answers