in reply to Read a config file
The key you're trying to split on (' \\') probably doesn't exist on your line. That will cause the entire line to be put into $ARGV[0]. Then you shift the only item in @ARGV out into $DisplayName.@ARGV = split(/ \\\\/, $Line);
Then you attempt a second shift$DisplayName = shift @ARGV || die;
This of course will fail since you've already wiped out @ARGV. This causes Win32::NodeName() to return the hostname of the current machine. Finally you attempt to build a UNC path.$Machine = Win32::NodeName() unless( $Machine = shift @ARGV );
Win32::Service::GetServices() requires a hostname, not a UNC path. So what you end up feeding Win32::Service::GetServices() is a host name with two backslashes it. This causes it to fail, and windows generates the "The RPC server is unavailable" error.$Machine = "\\\\$Machine"; $Machine =~ s/^\\{2,}/\\\\/;
|
|---|