cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dinesh_redhawk
Level 6

How to get physical memory [RAM] size on the host machine through Installscript

Hello,

I have a requirement to throw an error and stop the installation if Physical memory [RAM] is found to be less than 16 GB.
The problem here is based on my research PhysicalMemory property can be used but it has a limitation of checking upto 2GB RAM only. Even if RAM is more than 2GB it will return the available RAM as 2GB.

Secondly, GetSystemInfo also cannot be used as internally it uses PhysicalMemory property only.

I dont want to write a separate C# dll just to detect the memory size before installation begins. Is there anything else i can do?

Please suggest thanks.
Labels (1)
0 Kudos
(6) Replies
dinesh_redhawk
Level 6

dinesh_redhawk wrote:
Hello,

I have a requirement to throw an error and stop the installation if Physical memory [RAM] is found to be less than 16 GB.
The problem here is based on my research PhysicalMemory property can be used but it has a limitation of checking upto 2GB RAM only. Even if RAM is more than 2GB it will return the available RAM as 2GB.

Secondly, GetSystemInfo also cannot be used as internally it uses PhysicalMemory property only.

I dont want to write a separate C# dll just to detect the memory size before installation begins. Is there anything else i can do?

Please suggest thanks.


Solution:
I called the following command which writes the total free RAM size in a text file.
szCmdLine = "/C wmic computersystem get TotalPhysicalMemory >" + szFilePath;

But iam stuck in converting the size of the RAM (in string) to number as it exceeds the NUMBER datatype size limit.
Any guidance please.
0 Kudos
rguggisberg
Level 13

In your case it probably does not need to be exact... so is it good enough to drop the last 6 digits of the string and then convert? Number will be close to amount of RAM in MB.
0 Kudos
dinesh_redhawk
Level 6

rguggisberg wrote:
In your case it probably does not need to be exact... so is it good enough to drop the last 6 digits of the string and then convert? Number will be close to amount of RAM in MB.


I guess, you are right.. Can be done. let me try. You are genius 🙂
0 Kudos
dinesh_redhawk
Level 6

dinesh_redhawk wrote:
I guess, you are right.. Can be done. let me try. You are genius 🙂


I tried, it gives approx value, but my lead is asking to get the exact value...not to depend on approximation.

can you please reply to this thread

https://community.flexerasoftware.com/showthread.php?223068-Parsing-string&p=515469#post515469
0 Kudos
rguggisberg
Level 13

dinesh_redhawk wrote:
I tried, it gives approx value, but my lead is asking to get the exact value...not to depend on approximation.

can you please reply to this thread

https://community.flexerasoftware.com/showthread.php?223068-Parsing-string&p=515469#post515469


Now that you are using SYSTEMINFO instead of WMIC... we have this covered... right?
0 Kudos
dinesh_redhawk
Level 6

dinesh_redhawk wrote:
Solution:
I called the following command which writes the total free RAM size in a text file.
szCmdLine = "/C wmic computersystem get TotalPhysicalMemory >" + szFilePath;

But iam stuck in converting the size of the RAM (in string) to number as it exceeds the NUMBER datatype size limit.
Any guidance please.


Solution:
https://community.flexerasoftware.com/showthread.php?223068-Parsing-string

for someone who might need
0 Kudos