Looking for sample javascript (not vbscript) to access WMI Objects

Specifically, I'm trying to get the readyboost parameters:

"ReadyBoost Cache", "Total read bytes/sec"

Thanks

Peter Kellner
http://peterkellner.net
ASP.NET, MVP



Answer this question

Looking for sample javascript (not vbscript) to access WMI Objects

  • David_navigator

    You'll be after "Win32_PerfFormattedData_EmdCache_ReadyBoostCache.TotalreadbytesPersec". But you won't be able to read this without Elevated Admin rights, so it's going to be pretty useless!

    Here's the code:

    var oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!//./root/cimv2");
    var cItems = oWMI.ExecQuery("Select * from Win32_PerfFormattedData_EmdCache_ReadyBoostCache");

    var cItem = new Enumerator(cItems);
    for (; !cItem.atEnd(); cItem.moveNext())
    {
    var cacheSize = cItem.item().Bytescached;
    var totalReadBytesPerSec = cItem.item().TotalreadbytesPersec;
    }



  • Looking for sample javascript (not vbscript) to access WMI Objects