Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW CAN I GET THE AVAILABLE MEMORY???

Status
Not open for further replies.

vivis

IS-IT--Management
Oct 1, 2002
17
MX
HI I NEED TO DO A SCRIPT THAT GETS THE AVAILABLE PHYSICAL MEMORY IN A SERVER AND IF ITS UP 90% SEND A TRAP, I KNOW HOW TO GET THE TOTAL PHYSICAL MEMORY, BUT I DONT KNOW HOW TO GET THE AVAILABLE PHYSICAL MEMORY, I FOUND THIS SCRIPT

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set objMemory = objRefresher.AddEnum(objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet
objRefresher.Refresh
Do
For each intAvailableBytes in objMemory
If intAvailableBytes.AvailableMBytes < 4 Then
Wscript.Echo &quot;Available memory has fallen below 4 megabytes.&quot;
End If
Next
objRefresher.Refresh
Loop

BUT WHEN A TRY TO RUN IT IN MY NT MACHINE I GET THIS ERROR:

ActiveX Component cant create object: WbemScriptn.SWbemRefresher

Does anyone know why i get this error or how can i get total physical memory???? thanx a lot!!!!
 
This script will only run on XP and .NET what OS do you have Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top