in reply to Re: Using Win32 network shares
in thread Using Win32 network shares

What do you not understand?

Well, the book doesn't explain what the first parameter is. I got the module anyway, and its own documentation is better. But there are no examples. What's a CONNECTIBLE vs CONTAINER? etc.

Your example helps, e.g. only some of the possible fields in %NetResource are used. But I still don't know what the last parameter, $Connection or $Result for you, does. Your example uses TRUE/FALSE return and GetLastError for checking after the call, not this output parameter.

Keep in mind if the user and password are blank that says to keep it local to the machine you are accessing. I don't understand.

if you use this to disconnect and or allow for finding the share already mounted. I didn't parse that, either.

it wants an id and password which is bad since the password is plaintext. But if you are the sole user of the script and people won't see it....

Yes, I know the risks of having the password present in the script. In my application, it is uniquely not a problem! This is for my backup script. If you can access the files on this machine to read the script, you would not need to break into the backup machine.

Replies are listed 'Best First'.
Re: Re: Re: Using Win32 network shares
by Marza (Vicar) on Apr 06, 2002 at 00:46 UTC

    Always review the module docs! Most of the time they are pretty clear. Even Daves books has mistakes. One that drove me nuts was the option SV_TYPE_WORKSTATION for get servers. You read Daves book and it says all NT Workstations and yet you get everything. Well what that really does is get you anything that is running the Workstation service! BTW: Dave himself explained that one. Get on the Activestate win32 perl for admins list. He watches that and usually responds to stuff.

    As to your questions:

    A connectible is anything that you are allowed to connect to and use(ie a share or a printer).

    A container is simply an object that contains other objects(ie a domain is a container object that can contain users, computers and other objects).

    This stuff is more Windows 2000 than Perl related so I can describe it offline if you need more help.

    $connection is either 1 or 0. This is to tell Windows if the share is going to be a persistent connection(ie reboot and it is still there) so in your case as I saw above you don't want to perminanty mount so 0 would be good. However, dismounting is would be best. Use the

      CancelConnection($Name, $Connection, $Force)

    to get rid of the connection when you are done.

    $Result as used in the error message is simply used to build an error message which gets returned to the funcation caller

    "Keep in mind if the user and password are blank that says to keep it local to the machine you are accessing. I don't understand."

    Well I could have said that better. If you leave these blank. It will use the ID and password of the account that is logged on the computer that is running the script. Security would need to allow the access. Since this is a backup script; everything should already be set up.