http://qs321.pair.com?node_id=307063


in reply to Remote Win32 User

I think you are looking for Win32::NetResource

Code Snippet:

my $localdrive = "x:/"; my $RemoteName = "\\\\RemoteSrv\\RemoteShare"; %NetResource = ( LocalName => "$localdrive", RemoteName => "$RemoteName"); my $User = "User"; my $Password = "Password"; if ( Win32::NetResource::AddConnection( \%NetResource, $Pa +ssword, $User, 0) ) { print "Connection Successful!\n"; } else { print "Connection Failed: $^E \n"; }
you can noe check on $NetResource{LocalName} for the file you want.

You are effectively mapping a drive to a remote share with specified credentials.

Update: You can put this code into a win32 service which starts as any user and connect with the local user from the remote machine. (You might need to put the machine name that you are connecting to in front of the remote username ie. remotemachine\remoteuser..)

Update2: You will need to have NetBIOS (I think) access through the firewall.. basically if you can map a drive from the machine with perl to the remote machine, you can use the above code..;)

-----
Of all the things I've lost in my life, its my mind I miss the most.

Replies are listed 'Best First'.
Re: Re: Remote Win32 User
by tos (Deacon) on Nov 18, 2003 at 11:01 UTC
    good advice.

    but on my system the slash in $localdrive must not appear. After removing it the connection could be established properly.

    greetings, tos

Re: Re: Remote Win32 User
by nimdokk (Vicar) on Nov 14, 2003 at 15:48 UTC
    That might just do the trick. I'll take a look at that particular module and see if it is the answer. Thanks.


    "Ex libris un peut de tout"