View Full Version : How to detect RAM size? (All)
stangor
07-01-2002, 05:49 PM
Thank you
Open control panel & double click system
stangor
07-01-2002, 09:26 PM
Thank you for your responce. I looking for an utility or scripting solution.
Stan
s = 0
For Each instance In GetObject(_
"winmgmts:{impersonationLevel=impersonate,(Debug)}")_
.InstancesOf("win32_PhysicalMemory")
s = s + instance.Capacity
response = MsgBox(instance.getObjectText_, vbOkcancel)
If response=vbCancel Then
Exit For
End If
Next
wscript.echo "Total Memory: " & s
'================ Extended Data =================
For Each instance In GetObject(_
"winmgmts:{impersonationLevel=impersonate,(Debug)}")_
.InstancesOf("win32_PhysicalMemory")
response = MsgBox(instance.getObjectText_, vbOkcancel)
If response=vbCancel Then
Exit For
End If
Next
'=================================================
Jama
troccola1
07-11-2002, 04:20 PM
I need to do this as well.
I am BRAND NEW to this stuff.
I've taken the code below and placed it in a ".vbs" file and tried it in a ".js" file.
Neither work.
Obviously, I'm lost!
What did I miss?
troccola1
07-11-2002, 05:44 PM
Also, I am able to get other scripts I find here working... just this one is failing.
I'm on WINNT now, but want this to work on NT, 2000, & XP.
Andy-S
07-11-2002, 06:50 PM
I ran the script on Windows 2000 and it was fine. Have you tried it on Windows 2000?
Cheers
Andy
The above two scripts use Windows Management Instrumentation (WMI) to retrieve information about the RAM installed on the computer.
WMI is included with Windows ME, 2000 and XP by default. For 95, 98 and NT, you’ll have to download and install the WMI component.
Scripts can also use the Windows Scripting Host (WSH) to perform various actions on a pc running windows. This is the reason why some scripts work while others don’t. if you are wondering when did you install WSH, then here is the answer;
On Windows 95 & NT
WSH is installed if you install Internet Explorer 5, or if you download WSH from Microsoft.
On Windows 98
WSH is installed if you choose a standard installation of the operating system, or if you install Internet Explorer 5, or if you download WSH from Microsoft.
On Windows ME, 2000 & XP
WSH is installed by default.
To access hardware on a pc, you’ll have to use WMI. I don’t know if it’s possible to do that with WSH.
<a target="_blank" href=http://msdn.microsoft.com/downloads/sample.asp?url=/msdn-files/027/001/576/msdncompositedoc.xml> Click here to download WMI </a>
If you don’t have WSH installed and would like to download it, <a target="_blank" href=http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/733/msdncompositedoc.xml> then click here. </a>
Here is another way to get the amount of RAM installed. This method uses WMI too.
For Each instance In GetObject(_
"winmgmts:").InstancesOf("Win32_ComputerSystem")
wscript.echo "Total Memory: " &_
Round(instance.TotalPhysicalMemory / 1048576, 0) & "MB"
Next
Jama
troccola1
07-15-2002, 02:29 PM
Great, that was the problem. I can run the memory script now.
Thanks
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.