use Net::Telnet(); print "count is $i\n"; open (OUT,">D:/PERL/TELNET_OUTPUT.txt") or die "could not open new.txt\n"; open(FILE, "D:/PERL/ip.txt") || die "Failed\n"; foreach $x () { $telnet = Net::Telnet-> new(Host =>"$x",timeout =>13)or $telnet_err=1 ; if ($telnet_err){ print "Unable to telnet to $host machine\n";} $telnet -> login(root,siemens) or $login_err=1; if ($telnet->cmd("uname") == "Linux") { print OUT "\n<===========================>\n"; print OUT "\nWELCOME. You have Logged in to $x\n"; print OUT "\n----------------\n"; print OUT "Current Date: "; print OUT $telnet->cmd("date| tail -1"); print OUT "\n----------------\n"; print OUT "Serial Number of the Machine is: "; print OUT $telnet->cmd("dmidecode -t system | grep Serial"); print OUT "\n----------------\n"; print OUT "Operating System of the Machine is: "; print OUT $telnet->cmd("uname | tail -1"); print OUT "\n----------------\n"; print OUT "Host Name of the Machine is"; print OUT $telnet->cmd("hostname| tail -1"); print OUT "\n----------------\n"; print OUT " Disk Information of the Machine is"; print OUT $telnet->cmd("df -kh"); print OUT "\n-----------\n"; print OUT "IP Address of the Interfaces are : \n"; print OUT $telnet->cmd("/sbin/ifconfig -a | grep inet| cut -d\" \" -f2"); print OUT "\n-----------\n"; print OUT "MAC Address of the INterfaces are:\n"; print OUT $telnet->cmd("/sbin/ifconfig -a | grep ether"); }