| Store | Cart

Win32::NetResource problem

From: Natxo Asenjo <natx...@gmail.com>
Wed, 23 Mar 2011 12:20:15 +0100
hi,

I need to mount a samba share from Perl. This is the code:

#!perl

use warnings;
use strict;

use Win32::NetResource;

my %netresource = (
    RemoteName      => "\\\\server\share" ,
);

my $username = "user" ; # also tried "workgroup\\user"
my $password = "password" ;

# print "$username\n" ;
# print "$password\n" ;

my $mapping = Win32::NetResource::AddConnection(
        \%netresource, $username, $password, 0 ) or warn win32err();

sub win32err {
    my $err;
    Win32::NetResource::GetError($err);
    Win32::FormatMessage($err);
}

When I run it, I get:

Z:\scripts>perl mapshare.pl
The specified network password is not correct.

I know the username/password combo is correct, because using net use
it works. I have tried adding the workgroup to the $username like so:
$username = "workgroup\\user"  but to no avail.

The samba server is not a part of a domain, it has its own workgroup.

Has anyone gotten such a setup to work?

TIA,
--
Groeten,
natxo
_______________________________________________
Perl-Win32-Admin mailing list
Perl...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
Natxo Asenjo Mar 23, 2011 11:20 am
Christopher Taranto Mar 23, 2011 02:50 pm
Mark Leighton Mar 25, 2011 01:25 pm
Messages in this thread