Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win32::NetResource AddConnection problem please help

Status
Not open for further replies.

mlibeson

Programmer
Mar 6, 2002
311
US
Here is my code:

Code:
use Win32;
use Win32::NetResource qw(:DEFAULT AddConnection CancelConnection);
$| = 1;

%NETRESOURCE = {
'Scope' => "RESOURCE_GLOBALNET",
'Type' => "RESOURCETYPE_ANY",
'DisplayType' => "RESOURCEDISPLAYTYPE_GENERIC",
'Usage' => "RESOURCEUSAGE_CONNECTABLE",
'LocalName' => "D:",
'RemoteName' => "//server/sharename",
'Comment' => '',
'Provider' => ''
};

my $rs = AddConnection(\%NETRESOURCE, 'USERID', 'PASSWORD', 1);
print STDOUT "$rs\n";

print STDOUT `dir D:`;


Here is my output:

Code:
G:\Utils>perl t.pl
0
The system cannot find the path specified.

I do have permission to access the share drive and I can map the remote share to the D: drive, but it does not seem to be doing it in the PERL script.

Can anyone shed some light please.

Thank you.


Michael Libeson
 
Which path can't the system locate?

D:

or

"//server/sharename

or

G:\

I would think the last.


- Kevin, perl coder unexceptional!
 
I am in G: when I start, but I want to map the share to the D: drive.


Michael Libeson
 
I don't suppose this matters, but try:

Code:
'RemoteName' => "\\\\server\\sharename",

the Windows Explorer doesn't recognize two forward slashes as a network place like it does with a local directory. When I typed in "C:/Program Files" it changed it to "C:\Program Files" and took me there, but when I type in "//upsilon" (the name of my computer), it took me to " instead, probably for being unable to find the directory, whereas typing "\\upsilon" took me to the right place.

-------------
Kirsle.net | Kirsle's Programs and Projects
 
Thank you Kirsle, but it did not work either. If I ever get it right, I will post my solution.


Michael Libeson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top