Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a script using the windows utility robocopy.exe to backup all network shares to a local drive. The shares are all password protected, and I would like to access them entering the password but without mapping a drive. I've used Win32::NetResource to map drives, but even after succesfully doing so (and entering the correct password) robocopy gives Error 86 "The specified network password is not correct" when I try to backup the drive. However, if I manually open the drive, then the backup is properly performed. Any suggestions?
  • Comment on Access password protected network share without mapping

Replies are listed 'Best First'.
Re: Access password protected network share without mapping
by jlongino (Parson) on Dec 24, 2001 at 01:30 UTC
    I'm probably one of the last people to offer networking related advice, so if I'm way off base chalk it up to a successful "gift shopping avoidance" ploy.

    Have you tried authenticating to the server and then using UNC references (\\computername\path\to\backup\data) to the resource in question? If you have, it would be useful for other monks to know. Any other attempts, whether successful or not, would be informative also.

    --Jim

      Excuse the naivity, but how do I authenticate to the server on a peer-to-peer windows network. I have successfully used straight UNC references on some of the networked computers without having to give a password or map a network drive (even though they are all password protected shares). However, I could not successfully access files from many of the other computers, even after mapping a drive to them. Access was only possible after manually opening the network share and entering the password when prompted.
        You'll probably want to check out Win32::NetResource module and some of its functions: NetShareAdd(), NetShareCheck(), NetShareDel(), NetShareGetInfo() and NetShareSetInfo(). I have never used these modules before but they appear from the brief descriptions given in Perl in a Nutshell to do what you ask (including password authentication).

        My previous post was based on the assumption that authentication to any necessary network resources had been established via manual network login/mapping/etc. HTH,

        --Jim

        Update: I did some experimentation at this node and grep determined that it appears Win32::NetResource only runs on NT platforms. crazyinsomniac noted the fact is not in the perldocs for that module.

Re: Access password protected network share without mapping
by Anonymous Monk on Apr 07, 2005 at 04:37 UTC
    Has anyone come up with a solution? I am wanting to transfer bkf files (windows native backup format) across the network to the server for safe keeping. How can I access a password protected share from within perl? Thanks team