The Win32::FileOp module should give you everything you need and more.
You can download it from Jenda's site here: http://jenda.krynicky.cz/#Win32::FileOp
-----Original Message-----
From: Wening Andreas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 3:37 PM
To: '[EMAIL PROTECTED]'
Subject: map a w2k share
Hi,
Is there a way to map directly a w2k share with perl? I tryed it with the
"net use..." and system, but somehow it doesn't work if I have to map 2
drives. I also put in a sleep just in case the mapping is to fast. The first
mapping always goes through, the second fails 90% of the time. Sometimes, if
I change the drive letters it works for a while. If it fails, it doesnt tell
me why $! is empty. So is there another way to map it directly from perl and
not with the system command?
Here the code I use:
=================================
...blabla...
&mapdrive ($drive1, $share1);
sleep 3;
&mapdrive ($drive2, $share2);
sub mapdrive {
my ($letter, $share) = @_;
my $dos_cmd = "net use $letter: /delete";
system $dos_cmd;
print "Deleted: $dos_cmd\n" or &error ("Couldn't execute: $dos_cmd,
$!", 3);
my $dos_cmd = "net use $letter: $share /PERSISTENT:NO";
!system $dos_cmd or &error ("Couldn't execute: $dos_cmd, $!", 3);
print "Mapped: $dos_cmd\n";
}
=================================
=========================================
s
Siemens Shared Services LLC.
Andreas Wening
IT Infrastructure Architect
186 Wood Avenue South
Iselin, NJ 08830
Tel: 732.590.2067
Fax: 732.321.4915
Email: [EMAIL PROTECTED]
=========================================
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs