About us

IIS covers the IT solutions to the issues come across now and then in a company IT infrastructure including Operating system, Softwares, Scriptings, securities and reviews.

Tuesday, 25 February 2014

Real Physical Memory Size in Machine

I have created one script to figure out the machine physical memory. This will provide its size in MB as well as in GB. It is dificult to know the exact size while applying simple coding Thus I created one with more coding and can be used the exact size.

Start

On Error Resume Next
Const GB = 1073741824
Const MB = 1048576
Dim Obj, Wmi

Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem")
 If Obj.TotalPhysicalMemory > Int(GB) Then
  msgbox _
  "Total Physical Memory : " & FormatNumber(Obj.TotalPhysicalMemory / GB,2) & " GB"
 Else
  msgbox _
  "Total Physical Memory : " & FormatNumber(Obj.TotalPhysicalMemory / MB,2) & " MB"
 End If
Next

Finish

Regards, IIS

No comments:

Post a Comment