Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to write vbscript equivalent to perl

by esskar (Deacon)
on Dec 28, 2005 at 14:17 UTC ( #519555=note: print w/ replies, xml ) Need Help??


in reply to How to write vbscript equivalent to perl

here we are:

use strict; use Win32::OLE qw( in ); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my $NameSpace = "root\\cimv2"; my $Machine = shift @ARGV || "."; $Machine =~ s/^[\\\/]+//; print $Machine. "\n"; my $WMIServices = Win32::OLE->GetObject( "winmgmts:{impersonationLevel = impersonate}!\\\\$Machine\\$NameSp +ace") || die; # get TotalVisibleMemorySize, FreePhysicalMemory, TotalVirtualMemoryS +ize, FreeVirtualMemory print "Win32_OperatingSystem: "; my $col = $WMIServices->ExecQuery( "SELECT * FROM Win32_OperatingSyste +m", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly ); foreach my $memOS (in $col) { printf "%s %ld %ld %ld %ld", $memOS->{Name}, $memOS->{TotalVisibleMemorySize}, $memOS->{FreePhysicalMemory}, $memOS->{TotalVirtualMemorySize}, $memOS->{FreeVirtualMemory}; }


Comment on Re: How to write vbscript equivalent to perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519555]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2015-07-07 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls