Please help... Desperate - final piece of the puzzle!!
I need to map a UNC share to move some files.
This code works fine when I run it manually.
I cannot get it to run with an AT command. Any ideas?
I have tried the following AT commands with no success and no results
returned. All other AT commands seem to be working as expected.
at 00:01 script.pl
at 00:01 /interactive script.pl
at 00:01 /interactive cmd /k "script.pl"
<<< Short script from "Win32 Perl Programming" second edition pages 60 & 61
>>>
use Win32::NetResource;
my %NetResource = (
LocalName => "Q:",
RemoteName => "\\\\main\\share"
);
my $User = "tester";
my $Passwd = "passw0rd";
Win32::NetResource::AddConnection ( \%NetResource, $Passwd, $User, 0 );
<<< end >>>
<<< Short script from "Win32 Perl Programming" second edition pages 60 & 61
PLUS error sub from pages 27 & 28 >>>
use Win32::NetResource;
use Win32::WinError;
my %NetResource = (
LocalName => "Q:",
RemoteName => "\\\\main\\share"
);
my $User = "tester";
my $Passwd = "passw0rd";
if( Win32::NetResource::AddConnection ( \%NetResource, $Passwd, $User, 0 )
) {
print "Successful!\n";
}
else
{
print NetError();
}
sub NetError {
my( $Error, $Text, $Provider );
$Error = Win32::GetLastError();
if( ERROR_EXTENDED_ERROR == $Error ) {
Win32::NetResource::WNetGetLastError($Error, $Text, $Provider
);
$Result = "Error $Error; $Text (generated by $Provider)";
}
else
{
$Text = Win32::FormatMessage( $Error );
$Result = "Error $Error: $Text";
}
return $Result;
}
<<< end >>>
I have even tried this with a simple batch file and I can't get it to
work....
at 00:01 script.bat
<<< script.bat >>>
net use Q: \\main\share /user:tester passw0rd
<<< end >>>
Again, works great running it manually, but never works and returns no
errors when run by AT command. I have tried it on more than one machine.
Is this possibly something that NT won't do?
Thank you!!
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs