in reply to How do you Map & Disconnect Network Drives (in Windows)?

Do you need to map the shares to drive letters at all? You can access files on the shares directly by using their UNC names:

my $server = "\\\\$machine\\C\$"; my $fullname = "$server\\some\\file"; open my $fh, "<", $fullname or die "Couldn't open '$fullname': $!";

Replies are listed 'Best First'.
Re^2: How do you Map & Disconnect Network Drives (in Windows)?
by perlofwisdom (Pilgrim) on Mar 26, 2008 at 13:48 UTC
    Thank you for the suggestion (and the code snippet), that would solve all sorts of problems. Unfortunately, I hit an "Access denied" issue (which is a whole other problem). It's curious though because when I "map" the drive, I have full rights.

      The file access runs as the current user with the permissions of the current user. If you want to do the access with the credentials of a different user, you will either have to use the impersonation APIs or map the network drive.