CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Pyrofreak] Connection to a Networkdrive in a different Domain: Edit Log



Pyrofreak
New User

Aug 26, 2011, 5:02 AM


Views: 2105
Re: [Pyrofreak] Connection to a Networkdrive in a different Domain

I figured out a way to do this with Win32::NetResource


Code
use Win32::NetResource; 


my $RemoteName = "\\\\123.456.789.10\\folder";

my $RemoteShare = {
'Scope' => RESOURCE_CONNECTED,
'Type'=> RESOURCETYPE_DISK,
'DisplayType' => RESOURCEDISPLAYTYPE_GENERIC,
'Usage' => RESOURCEUSAGE_CONNECTABLE,
'RemoteName' => $RemoteName,
};

my $UserName = "test2\\testuser";
my $Password = "password";
my $Connection = 0;

Win32::NetResource::AddConnection($RemoteShare,$Password,$UserName,$Connection)
or print "unable to connect to the network\n";

open(FILE, "$RemoteName\\test.txt");


Maybe this will help someone that will have the same Problem at some point ^^


(This post was edited by Pyrofreak on Aug 26, 2011, 5:05 AM)


Edit Log:
Post edited by Pyrofreak (New User) on Aug 26, 2011, 5:03 AM
Post edited by Pyrofreak (New User) on Aug 26, 2011, 5:05 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives