use strict; use Win32::OLE qw(in); my $WMI = Win32::OLE->GetObject("winmgmts:") or die ("Could not create WMI object."); my $OS_Col = $WMI->InstancesOf('Win32_OperatingSystem') or die ("Could not get OS instances."); foreach my $OS (in $OS_Col) { printf "Free Physical Memory: %10u kB\n", $OS->{FreePhysicalMemory}; printf "Free Virtual Memory: %10u kB\n", $OS->{FreeVirtualMemory}; printf "Total Virtual Memory: %10u kB\n", $OS->{TotalVirtualMemorySize}; printf "Total Visible Memory: %10u kB\n", $OS->{TotalVisibleMemorySize}; }