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 "Available memory has fallen below 4 megabytes."
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!!!!
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 "Available memory has fallen below 4 megabytes."
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!!!!