Title: RE: Running Perl Script through Windows 2000 Task Scheduler

My first suggestion is to get the latest Win32::Lanman (1.0.9.2), available at CPAN.  1.0.9.1 had some nasty bugs in it.

 

Scott Campbell

Senior Software Developer

Somix Technologies

(207) 324-8805

http://www.somix.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Dan Navilliat
Sent: Wednesday, June 05, 2002 11:03 AM
To: [EMAIL PROTECTED]
Subject: Net::Ping and Lanman

 

I have just gotten a new Win2k PC with perl v5.6.1 and can not run the below script which I could run on my old NT 4.0 PC running V5.005_03.  The new PC has Win32-Lanman [1.0.9.1] and Net-Ping [2.18].  What is happening is that the script will run through the 1st machine in a text file, but on the second machine the script will exit on the "$p = Net::Ping..." line.  I have debugged it to the point where if I rem out the "if(Win32::Lanman::QueryServiceConfig..." block the script will run OK.  It will just ping machines, but do nothing else. If I just have the QueryServiceConfig line and rem the lines below it the script still dies on the second machine in the list on the "$p = Net::Ping...." line. 

 

Does anyone have an idea as to why this might be happening or better yet, how to correct this?

 

 

 

foreach $server (@server) {
 $server =~ s/\\\\//;
 $p = Net::Ping->new("icmp");

 

 if (!$p->ping("$server")) {
     sleep (5);
     next;
     }
      
  foreach $service (@service) {
  if(Win32::Lanman::QueryServiceConfig("\\\\$server", '', "$service", \%config)){
    
      (Win32::Service::GetStatus("$server",$service ,\%status));
          if($status{CurrentState} ne 4) {
         &restart_service($server,$service,$badpc);
     $list="$list"."$badpc\n";
     $badpc=();
   
          }
  
  }
 }
}

Reply via email to