12-18-2007 03:06 AM
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.
12-18-2007 05:24 AM
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.
12-18-2007 06:02 AM
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???
12-18-2007 06:51 AM
I could use the perl script after making this small change in the very beginning of this script.
"#! c:/program files/"
12-18-2007 07:26 AM
...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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide