Using UNC address

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Dave

Using UNC address

Post by Dave » Sun Mar 30, 2003 1:48 am

Please give the option to copyfile or movefile from an UNC address, if it is not yet available.
In the meantime, is there a workaround? or to map a network drive using code?
Thanks

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Sun Mar 30, 2003 7:24 am

In the meantime, is there a workaround? or to map a network drive using code?
There was an example of UNC usage posted to the old mailing list by Peter Turner, using VBScript, and it could probably be tweaked to check for failed mappings too.

For now, here's a very simple workaround.
Let>sDrive=u:
Let>sUNCPath=\\otherpc\SHARENAME

Rem>Connect
Run>net use %sDrive% %sUNCPath%

Rem>Copy commands here

Rem>Disconnect
Run>net use %sDrive% /delete

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Mar 30, 2003 5:12 pm

In the meantime, is there a workaround?
A workaround is not needed. I use CopyFile every night to do backups using UNC to get copy files from about 10 workstations to one backup location. I actually have a comment line in the script to ONLY use UNC for Drive letters.

Here are some excerpted lines from a routine that does backup of Outlook files. (not a complete functioning routine, just some sample UNC lines ). When Outlook profiles are set up, each PST file is named with the login name of the user, example: outlook_bob.pst. This allows all copies of Outlook files to be kept in one folder if desired.
//List of various sources of Outlook files
//Only use UNC names for Drive IDs
Let>Source=\\22OFFICE_2\C\Windows\Application Data\Microsoft\Outlook\outlook_%Name%.pst
Let>Source=\\SERVER\C_DRIVE\Users\%Name%\outlook_%Name%.pst

Let>DestinationPath=\\OFFICE2\C_DRIVE\Bob\Backups
Let>Destination=%DestinationPath%
Concat>Destination,\%Name%\outlook_%Name%.pst

CopyFile>%Source%,%Destination%
=================================
or to map a network drive using code?
You can use the NET USE commands to do your mapping.
Go to a Command Prompt window and enter NET USE /? for syntax.
Use Run Program> to execute the NET USE commands.

Hope this helps
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Dave

Thank you

Post by Dave » Sun Mar 30, 2003 6:01 pm

Really . . . this saves my day.
Thanks and thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts