in reply to Perl $ENV hash

It's quite simple. On Windows, if you have Domain Administrator privileges, you can use WMI to query each machine. Otherwise, you'll have to log into each machine and query the environment information there.

Replies are listed 'Best First'.
Re^2: Perl $ENV hash
by kingjamesid (Acolyte) on Apr 20, 2010 at 14:08 UTC
    corion-
    I have domain admin privileges. how can I makes sure, i have WMIC libraries installed. Is this defauly?
    I ran perldoc WIN32::WMI but it said no docs found. so I am assuming lib not loaded.
    can you help me get started on where to look for the lib or if its already installed.
    THanks.
        what is wrong here. nothing is printing to the file, list.txt
        #use warnings; #use DBI; use Win32; use Win32::OLE qw (in); open(HLOG,">c:/temp/logf.txt") || die " Open Log_file: $!"; open(HLIST,">C:/temp/list.txt") || die " Open list.txt: $!"; #my $dbh = DBI->connect('dbi:DBI:'); while(<>) { chomp($_); @a = `ping -n 1 $_`; print "for $_:"; if ("@a" =~ /Request timed out/i || "@a" =~ /could not find host/i + ){ print "<<<<not Alive>>>>>\n"; #TODO #spit it to non-alive txt file #close file print(HLOG); } else { print "::: Alive\n"; my $Class = "WinMgmts://$_"; my $Wmi = Win32::OLE->GetObject ($Class); if ($Wmi) { my %Vars = $Wmi->ExecQuery("SELECT * FROM $Win32_Environme +nt"); print $Vars; foreach (keys %Vars) { print HLIST $Vars{$_} ."\n"; } } else { print "NO idea"; } #TODO: if alive, check if cadmap exists, if yes, spit the var= +value pair to a log.txt file. } } close (HLOG) || die "Close: $!"; close (HLIST) || die "Close:$!";