Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Remote Win32 User

by AcidHawk (Vicar)
on Nov 14, 2003 at 15:11 UTC ( #307063=note: print w/replies, xml ) Need Help??

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"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://307063]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2021-03-07 13:20 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (121 votes). Check out past polls.