vbscript - Get the server's cpu utilization -


i've searched around , got code apparently works everyone:

set objwmiservice2 = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")  set colitems = objwmiservice2.execquery("select * win32_perfformatteddata_perfos_processor name = '_total'")  each objitem in colitems      response.write( "cpu usage percentage: " & objitem.percentprocessortime & "%" ) next 

executing blank page, not error.

actually os virtualized on server, problem? , if so, there's workaround?

what's error you're getting?

here's i'm using same thing (stripped down bit). shows load per physical processor.

strcomputer = "." dim arrprocessors : redim arrprocessors(2,0)  set objwmiservice = getobject("winmgmts:" _     & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set colcpusystems = objwmiservice.execquery("select addresswidth,datawidth,numberofcores,name,maxclockspeed,loadpercentage win32_processor") proc = 0 each objproc in colcpusystems     arrprocessors(0,proc) = objproc.numberofcores     arrprocessors(1,proc) = objproc.maxclockspeed     arrprocessors(2,proc) = objproc.loadpercentage     proc = proc + 1     redim preserve arrprocessors(2,proc)     strosbits = objproc.addresswidth     strhwbits = objproc.datawidth     strprocessorcores = objproc.numberofcores     strprocessor = objproc.name     strprocessorspeed = objproc.maxclockspeed next  proc = 0 ubound(arrprocessors,2)-1     intload = arrprocessors(2,proc)     intfree = 100-intload      strprocessorinfo = strprocessorinfo & "processor " & proc+1 _     & ": " & arrprocessors(0,proc) & " cores : load " & intload & "%" & vbcrlf  next   wscript.echo strprocessorinfo 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -