#!/perl/bin/perl use Net::Telnet; use CGI qw(:all); #my @rv=`serverconfig.pl $host $newip $password $hostname $netmask # $gateway $dbdns1 $dbdns2 $dbwins1 $dbwins2`; my $username = "administrator"; my $host = "$ARGV[0]"; my $newip = "$ARGV[1]"; my $password = "$ARGV[2]"; my $servername = "$ARGV[3]"; my $netmask = "$ARGV[4]"; my $gateway = "$ARGV[5]"; my $dns1 = "$ARGV[6]"; my $dns2 = "$ARGV[7]"; my $wins1 = "$ARGV[8]"; my $wins2 = "$ARGV[9]"; my $t = Net::Telnet->new(Timeout =>5, Prompt=>'/\>/'); my $ok; $ok = $t->open($host); $ok = $t->login($username, $password); $ok = $t->cmd("netsh interface ip add dns \"Production LAN\" $dns1 index=1"); sleep 2; $ok = $t->cmd("netsh interface ip add dns \"Production LAN\" $dns2 index=2"); sleep 2; $ok = $t->cmd("netsh interface ip delete wins \"Production LAN\" all"); sleep 2; $ok = $t->cmd("netsh interface ip add wins \"Production LAN\" $wins1 index=1"); sleep 2; $ok = $t->cmd("netsh interface ip add wins \"Production LAN\" $wins2 index=2"); sleep 2; $ok = $t->cmd("echo netsh interface ip set address \"Production LAN\" static $newip $netmask $gateway 1 > c:\\\"Documents and Settings\"\\Administrator\\Desktop\\set_ip.bat"); sleep 2; $ok = $t->cmd("echo erase set_ip.bat >> c:\\\"Documents and Settings\"\\Administrator\\Desktop\\set_ip.bat"); sleep 2; $ok = $t->cmd("exit"); sleep 1; $t->close; print redirect("admin.cgi?query=$args");