Map many network shares using text file 
Author Message
 Map many network shares using text file

Can someone tell me how to take the information from a text file and
map various network drives using it?

I have this to map a network drive.

WshNetwork.MapNetWorkDrive "X:", "\\amdomain200\public\Jam"

I have this information in a text file and would like a script to read
all the drive letters and unc path's and map them.

Network Drive Mappings:
        Drive E: = \\amdomain100\Global\Common
        Drive N: = \\amdomain454\helpdesk
        Drive G: = \\amdomain103\sms_shr
        Drive I: = \\amdomain3501\coe_sl
        Drive J: = \\amdomain200\Group\Meyer
        Drive K: = \\amdomain499\common\BOB 4
        Drive L: = \\amdomain402\techinstall
        Drive M: = \\amdomain200\public\Jamin
        Drive F: = \\amdomain597\menu
        Drive H: = \\amdomain200\username$
        Drive X: = \\amdomain200\public\Jam

Thanks



Sat, 06 Nov 2004 21:57:53 GMT  
 Map many network shares using text file

Quote:

> Can someone tell me how to take the information from a text file and
> map various network drives using it?

> I have this to map a network drive.

> WshNetwork.MapNetWorkDrive "X:", "\\amdomain200\public\Jam"

> I have this information in a text file and would like a script to read
> all the drive letters and unc path's and map them.

Assuming the file contains *exactly* the following (including the 'Network Drive Mappings:' line) with *exactly* the spacing within each line...

Network Drive Mappings:
Drive E: = \\amdomain100\Global\Common
Drive N: = \\amdomain454\helpdesk
Drive G: = \\amdomain103\sms_shr
Drive I: = \\amdomain3501\coe_sl
Drive J: = \\amdomain200\Group\Meyer
Drive K: = \\amdomain499\common\BOB 4
Drive L: = \\amdomain402\techinstall
Drive M: = \\amdomain200\public\Jamin
Drive F: = \\amdomain597\menu
Drive H: = \\amdomain200\username$
Drive X: = \\amdomain200\public\Jam

Also assumes that you have already created a WshNetwork object and have removed all existing network drive mappings...

set fso = createobject("scripting.filesystemobject")
set ts = fso.opentextfile("mydatafile.txt")
arLines = split(ts.readall,vbcrlf)
ts.close

'starting n at 1 skips the 'Network ...' header.
'
for n = 1 to ubound(arLines)
  'stops on 1st blank line (if any)...
  if len(trim(arLines(n))) = 0 then exit for
  parts = split(arLines(n)," ")
  sDrive = parts(1)
  sUNCPath = parts(3)
  WshNetwork.MapNetWorkDrive sDrive, sUNCPath
next

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Sun, 07 Nov 2004 04:14:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using VB to copy a file from a network share to a client computer

2. Create/Remove drive map to network share

3. Mapping a network drive directly to a subfolder of a share

4. Map/UnMap Network Share Connections --> VB.Net

5. Mapping Network Share Help

6. Map a shared network drive in VB 4.0?

7. how to map a logical drive to a network share from VB

8. Map a network share from VB

9. Map shared network directory through TCP/IP

10. Script to create user shares using a text file

11. how to map a shared directory using API?

12. Mapping share using different uid/pwd in W95

 

 
Powered by phpBB® Forum Software