Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This works fine for one server. I want it to read a file with a list of servers and I changed the code, but of course it doesn't work I get an error: Could not connect to \\650SAN: The RPC server is unavailable. I changed the code to the following from the code above. This reads the file okay, but I get the error: "Could not connect to \\650SAN: The RPC server is unavailable". for each line it reads from the file.$DisplayName = shift @ARGV || die; $Machine = Win32::NodeName() unless( $Machine = shift @ARGV ); $Machine = "\\\\$Machine"; $Machine =~ s/^\\{2,}/\\\\/; if( Win32::Service::GetServices( $Machine, \%List ) )
while ($Line = <>) { chomp($Line); $Line =~ s/^[ \t]+//; ### Check for spaces and tabs and remove $Line =~ s/[ \t]+$//; ### Check for trailing spaces and tabs and r +emove $Line =~ s/[ \t]+/ /g; ### Global Substitution to remove extra spac +es and ### tabs between words @ARGV = split(/ \\\\/, $Line); $DisplayName = shift @ARGV || die; $Machine = Win32::NodeName() unless( $Machine = shift @ARGV ); $Machine = "\\\\$Machine"; $Machine =~ s/^\\{2,}/\\\\/; if( Win32::Service::GetServices( $Machine, \%List ) )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read a config file
by Limbic~Region (Chancellor) on Apr 12, 2007 at 21:22 UTC | |
|
Re: Read a config file
by badaiaqrandista (Pilgrim) on Apr 12, 2007 at 23:38 UTC | |
|
Re: Read a config file
by nega (Scribe) on Apr 13, 2007 at 17:52 UTC |