' Run this script at the command prompt by typing ' cscript usedMem.vbs Set objArgs = wscript.Arguments strComputer = objArgs.item(0) set oSvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") wqlQuery = "select FreeVirtualMemory,FreePhysicalMemory,TotalVirtualMemorySize,TotalVisibleMemorySize from Win32_OperatingSystem" for each oData in oSvc.ExecQuery(wqlQuery) for each oProperty in oData.Properties_ if oProperty.Name = "FreeVirtualMemory" then freeVirtual = oProperty.Value elseif oProperty.Name = "FreePhysicalMemory" then freePhysical = oProperty.Value elseif oProperty.Name = "TotalVirtualMemorySize" then totalVirtual = oProperty.Value elseif oProperty.Name = "TotalVisibleMemorySize" then totalPhysical = oProperty.Value end if next next percentVirtualUsed = 100 - (100 * (freeVirtual / totalVirtual)) percentPhysicalUsed = 100 - (100 * (freePhysical / totalPhysical)) wscript.echo int(percentVirtualUsed) wscript.echo int(percentPhysicalUsed) wscript.echo Date() & " " & Time() wscript.echo "Percent Used Virtual Memory" wscript.echo "Percent Used Physical Memory"