That seems to have done the trick, Yves. Thanks!
Actually, I had set up the scheduled task originally using a product called
WinAT which is what other folks here were using. When I looked at the
properties for that job in the "Scheduled Tasks" folder in Windows Explorer,
it looked like it thought it was using the same user that I used in the DOS
box. After getting your response, I deleted the original task and
re-scheduled it using the "Add Scheduled Task" wizard. The new task worked
just fine. Guess I'll just say no to WinAT from now on...
Thanks again!
Carl
-----Original Message-----
From: Dutrieux Yves [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 12:58 AM
To: 'Bauman, Carl'
Subject: RE: Accessing drives mapped via Win32::NetResource
try to change "scheduler" service to run on the same user that you use for
the dos box.
Yves
-----Message d'origine-----
De: Bauman, Carl [mailto:[EMAIL PROTECTED]]
Date: lundi 17 septembre 2001 22:25
�: '[EMAIL PROTECTED]'
Objet: Accessing drives mapped via Win32::NetResource
Hi All,
Please let me know if there is a more appropriate list to post this question
to.
I'm sure that this must be one of those things that everybody but me knows
about. When I run the following script from a DOS box command line it runs
fine:
use strict;
use Win32::NetResource;
my $home = "d:"; my $logfile = $home."\\dir1\\logfile"; my $drive =
'R:';
my $resource = {
'LocalName' => $drive,
'RemoteName' => "\\\\server\\share", };
my $audit_dir = undef; my $DOWARN = 1;
local $SIG{__WARN__} = 'handler';
open(LOG, ">>$logfile") or die "Can't open $logfile! - ($!)";
unless (Win32::NetResource::AddConnection($resource, undef, undef,
0)) {
my $err = undef;
Win32::NetResource::GetError($err);
warn Win32::FormatMessage($err);
}
$audit_dir = "r:\\dir2\\dir3\\dir4";
if (chdir "$audit_dir") { &do_stuff; }
else { warn "Can't change to $audit_dir: $!"; }
unless (chdir "$home") { warn "Unable to chdir to $home! - ($!)";
die; }
unless (Win32::NetResource::CancelConnection($drive, 0, undef)) {
my $err = undef;
Win32::NetResource::GetError($err);
warn Win32::FormatMessage($err); die;
}
close(LOG);
exit;
sub do_stuff { return 1; }
sub handler {
chomp (my $msg = shift);
print LOG "ERROR: $msg\n" if $DOWARN;
}
When I schedule it to run via "at" it prints the following error to my log
file:
ERROR: Can't change to r:\data\interfac\CDW3: No such file or
directory at d:\sw_pos\store_audit_extract.pl line 82.
This is running on a WinNT Server 4.0 (build 1381: Service Pack 6) box. If
anyone can tell me what I need to do to get it to run properly under "at",
I'd appreciate it.
Thanks,
Carl J. Bauman
Senior Business Analyst
Information Technology
Ultramar Diamond Shamrock Corporation
[EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin