All pastes #772915 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-14 04:07 UTC
rendered paste body
alias statsftw {
  //say 10info:14 $statsget(Win32_BaseBoard).Manufacturer $statsget(Win32_BaseBoard).Product
  //say 10os:14 $statsget(Win32_OperatingSystem).Caption ( $+ $statsget(Win32_OperatingSystem).CSDVersion $statsget(Win32_OperatingSystem).Version $+ )
  //say 10up:14 $uptime(system,1)
  //say 10cpu:14 $statsget(Win32_Processor).Name ( $+ $+($statsget(Win32_Processor).LoadPercentage,% Load) $+ )
  var %ram $round($calc($statsget(Win32_LogicalMemoryConfiguration).TotalPhysicalMemory / 1024),0) 
  var %ramload $round($calc(($round($bytes($statsget(Win32_PerfRawData_PerfOS_Memory).AvailableBytes).3,0)/%ram) * 100),0)
  //say 10ram:14 %ram $+ $+ MB ( $+ %ramload $+ % Load)
  var %i 1 
  while (%i <= $disk(0)) { 
    if ($disk(%i).type == fixed) var %hdd %hdd $disk(%i).path $bytes($disk(%i).size).suf ( $+ $bytes($disk(%i).free).suf free.)
    inc %i 
  }
  //say 10hdd:14 %hdd
  //say 10gfx:14 $statsget(Win32_VideoController).AdapterCompatibility $statsget(Win32_VideoController).VideoProcessor ( $+ $bytes($statsget(Win32_VideoController).AdapterRam).3 $+ MB $+ ) @ $+($statsget(Win32_VideoController).currenthorizontalresolution,x,$statsget(Win32_VideoController).currentverticalresolution) ( $+ $statsget(Win32_VideoController).currentbitsperpixel $+ bit $+ )
  //say 10net:14 $statsget(Win32_PerfRawData_Tcpip_NetworkInterface).Name @ $calc($statsget(Win32_PerfRawData_Tcpip_NetworkInterface).CurrentBandwidth / 1000000) $+ MB/s (in: $bytes($statsget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec).suf / out: $bytes($statsget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec).suf $+ )
}

alias statsget {
  var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  .comopen %com WbemScripting.SWbemLocator
  var %x = $com(%com,ConnectServer,3,dispatch* %com2), %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), %x = $comval(%com3,$iif($2,$2,1),$prop)
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  return %x
}