A colleague needed these today -- in case anyone else has need down the road --
(defun _GetRam ( / wmiLocater wmiService queryResult result )
[color=green] ;;========================================================================
;;
;; 2010/04/22 | Quick & Dirty | Michael Puckett
;;
;;========================================================================[/color]
(vl-catch-all-apply
'(lambda ( )
(vlax-for item
(setq queryResult
(vlax-invoke
(setq
wmiLocater (vlax-create-object "WbemScripting.SWbemLocator")
wmiService (vlax-invoke wmiLocater 'ConnectServer "." "root\\cimv2")
)
'ExecQuery
(strcat
"Select * "
"from Win32_ComputerSystem "
)
)
)
(setq result (vlax-get item 'TotalPhysicalMemory))
)
)
)
(if queryResult (vlax-release-object queryResult))
(if wmiService (vlax-release-object wmiService))
(if wmiLocater (vlax-release-object wmiLocater))
(if result (/ (distof result) 1024 1024)) [color=green];; return MB[/color]
)
(defun _GetFreeRam ( / wmiLocater wmiService queryResult result )
[color=green] ;;========================================================================
;;
;; 2010/04/22 | Quick & Dirty | Michael Puckett
;;
;;========================================================================[/color]
(vl-catch-all-apply
'(lambda ( )
(vlax-for item
(setq queryResult
(vlax-invoke
(setq
wmiLocater (vlax-create-object "WbemScripting.SWbemLocator")
wmiService (vlax-invoke wmiLocater 'ConnectServer "." "root\\cimv2")
)
'ExecQuery
(strcat
"Select * "
"from Win32_OperatingSystem "
)
)
)
(setq result (vlax-get item 'FreePhysicalMemory))
)
)
)
(if queryResult (vlax-release-object queryResult))
(if wmiService (vlax-release-object wmiService))
(if wmiLocater (vlax-release-object wmiLocater))
(if result (/ (distof result) 1024)) [color=green];; return MB[/color]
)
cheers