' run as cscript hello.vbs Dim strMessage strMessage = "Hello world in VB Script!" WScript.Echo strMessage strComputer = "." Set objWMIService = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colSettings Wscript.Echo "Total Physical Memory: " & objOperatingSystem.TotalVisibleMemorySize Wscript.Echo "Free Physical Memory: " & objOperatingSystem.FreePhysicalMemory Wscript.Echo "Total Virtual Memory Size: " & objOperatingSystem.TotalVirtualMemorySize Wscript.Echo "Free Virtual Memory Size: " & objOperatingSystem.FreeVirtualMemory Next 'also want to get percentage of CPU, Memory, VirtualMemory used #### use strict; use Win32::OLE qw( in ); my $NameSpace = "root/cimv2"; my $Machine = shift @ARGV || "."; $Machine =~ s/^[\\\/]+//; print $Machine."\n"; my $WMIServices = Win32::OLE->GetObject( "winmgmts:{impersonationLevel = impersonate}!//$Machine/$NameSpace" ) || die; # get TotalVisibleMemorySize, FreePhysicalMemory, TotalVirtualMemorySize, FreeVirtualMemory print "Win32_OperatingSystem: "; my $memOS = $WMIServices->InstancesOf(Win32_OperatingSystem); printf "%s %ld %ld %ld %ld",$memOS->{Name}, $memOS->{TotalVisibleMemorySize}, $memOS->{FreePhysicalMemory}, $memOS->{TotalVirtualMemorySize}, $memOS->{FreeVirtualMemory};