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.