Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


VBScript - How much memory? Processor Info?

Posted on 2006-03-23
Medium Priority
Last Modified: 2008-01-09
I need to get the RAM (total/free) and the processor info (speed/type) without using the WMI because this script will run on Win95/98 boxes that might not have WMI installed.
Question by:schworgj
  • 3
  • 2

Expert Comment

ID: 16279218
If it were me, I would script the installation of WMI (via login script) on those Win9x boxes since permissions aren't an issue. The vbScript could then check if WMI is present, collect the inventory. I have an old kixtart script I could post that installs WMI. I know your question was about vbScript, but you can lauch a kixtart script from within vbScript.

Author Comment

ID: 16280575
I have been told that we are not to install anything on these computers. Scripting the install was my first thought too.
LVL 41

Accepted Solution

graye earned 1500 total points
ID: 16281417
That's a tall order... particularly if your stuck with VBScript and can't use WMI

The CPU Identifieris at HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0.   On newer OS (but not Win9x), the CPU speed is also at that location

Memory can be obtained using the GlobalMemoryStatus API

    dwLength As Long
    dwMemoryLoad As Long
    dwTotalPhys As Long
    dwAvailPhys As Long
    dwTotalPageFile As Long
    dwAvailPageFile As Long
    dwTotalVirtual As Long
    dwAvailVirtual As Long
End Type

Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)

    Dim mb As Long
    mem.dwLength = Len(mem)
    GlobalMemoryStatus mem
    ' add 384k to account for upper memory area
    mb = (mem.dwTotalPhys + 393216) / 1048576
    ' round off to nearest MB
    If ((mb * 1048576) - mem.dwTotalPhys - 393216) > 524288 Then
        mb = mb + 1
    End If
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 16281926
Can't use this code in VBScript. At least not the memory section. Thanks for the registry location of the processor.  I'll leave the question open a bit longer to see if I can get the memory part answered too then split the points accordingly.
LVL 41

Expert Comment

ID: 16282063
Yeah, if you're stuck with VBScript, your hands are kinda tied.   However VBScript can use DLLs.  For example, there are a lot of good CPU detection/speed tools available as COM-based DLLs.

Are you at least allowed to register a DLL on these PCs?

Author Comment

ID: 16282106
I got the CPU info out of the registry. It isn't as much info as we would like but it will do. I am amazed that there isn't a simple way to check total/free memory without some DLL or WMI. VBScript is pretty limited in what it can do without external tools.

I don't think we are supose to put anything beyond the single script on the user's PC. Actually, the script is sitting on a network drive and just gets called. Long story but we are trying not to actually install anything beyond a shortcut to this script.

Driving me nuts.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question