Jump to content
Sign in to follow this  

Get RAM and HDD sapce info.

Recommended Posts

MsgBox(1,"",PercentMemoryFree() & "% Free physical memory")
MsgBox(1,"",PercentHardDriveFree() & "% Free space on C:")

Func PercentMemoryFree()
    Local $objWMI = ObjGet("winmgmts:\\.\root\cimv2")
    Local $collection = $objWMI.ExecQuery("Select * from Win32_OperatingSystem")
    Local $FreeMemory
    Local $TotalMemory
    Local $obj

    For $obj In $collection
        $FreeMemory = $obj.FreePhysicalMemory

    $collection = $objWMI.ExecQuery("Select * from Win32_ComputerSystem")
    For $obj In $collection
        $TotalMemory = $obj.TotalPhysicalMemory
    Return Int((($FreeMemory*1024) / $TotalMemory) * 100)

Func PercentHardDriveFree()
Return Int((DriveSpaceFree("C:") / DriveSpaceTotal("C:")) * 100)

Edited by covaks

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...