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 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 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")
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

 Page 1 of 1 [ 2 post ]

Relevant Pages