unmanageip.pl for windows

Unanswered Question
Dec 18th, 2007

I have this unmanageip.pl perl script for solaris but i require one for windows.


Could somebody provide me one for windows or help convert this one to windows, i do not wish to approach TAC just for this small a job.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Martin Ermel Tue, 12/18/2007 - 05:24

I do not know of an OS dependent script for this issue. As I know it is independent of the OS and just a plain perl script that runs on both solaris and windows as it uses environment variables.

vijay sanwal Tue, 12/18/2007 - 06:02

This is how it goes:


#! /opt/CSCOpx/bin/perl -w

use CRM;


print "Enter the first octet of ip address ";

my $fo = ;

chomp($fo);



if ( ($fo < 0) || ( $fo > 255) ) {


printf "Out of range value for first octet \n";

exit;


}



print "Enter the second octet of ip address ";

my $so = ;

chomp($so);



if ( ($so < 0) || ( $so > 255) ) {


printf "Out of range value for second octet \n";

exit;


}



print "Enter the begining third octet ";

my $b3o = ;

chomp($b3o);


if ( ($b3o < 0) || ( $b3o > 255) ) {


printf "Out of range value for beginning of third octet \n";

exit;


}



print "Enter the ending third octet ";

my $e3o = ;

chomp($e3o);


if ( ($e3o < 0) || ( $e3o > 255) ) {


printf "Out of range value for end of third octet \n";

exit;


}


if ( $b3o > $e3o) {

print "Invalid range for third octet ";

exit;

}



print "Enter the begining fourth octet ";

$b4o = ;

chomp($b4o);


print "Enter the ending fourth octet ";

$e4o = ;

chomp($e4o);


if ( $b4o > $e4o) {

print "Wrong second octet ";

exit;

}




for ($i=$b3o; $i <= $e3o; $i++) {


for ($j=$b4o; $j <= $e4o; $j++) {


my $ipaddress=$fo . "." . $so . "." . $i . "." . $j;



my $command=$ENV{NMSROOT} . '\objects\smarts\bin\dmctl -s DFM invoke IP::IP-' . $ipaddress . " setManagedState

UNMANAGED";


printf " command is $command \n";

system $command;


}



}




OPT directory in the very begining makes me doubtful. Can you confirm if a change to "#! c:/program files/" instead of OPT will suffice the purpose???

vijay sanwal Tue, 12/18/2007 - 06:51

I could use the perl script after making this small change in the very beginning of this script.


"#! c:/program files/"

Martin Ermel Tue, 12/18/2007 - 07:26

...and you even could use the script without the change because Windows perl does not use the she-bang in the first line - it is necessary only for unix.

Actions

This Discussion