#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 "<<<>>>>\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_Environment"); 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:$!";