0

I am very new to VBS. I am trying to make a tool that will help with migration of users for a refresh comming up. I need to grab printers and drive mappings from the current user on a machine, export to a file, copy file to new machine and then import that file. (no registry interaction)

The printer section I have already, Its the mapped network drives that are an issue. IBelow is the script for exporting.

Set objFSO = CreateObject("Scripting.FileSystemObject")

Const ForAppending = 8

Set objTextFile = objFSO.OpenTextFile _
 ("C:\Mapped_Drives.txt", ForAppending, True)


Set objNetwork = WScript.CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
 objtextfile.writeline (colDrives.Item(i) & vbTab & colDrives.Item (i + 1))
Next
objtextfile.close

This creates a file that looks like

P: \server\share

Z: \server\share

Y: \server\share

I am trying to find some way to import this information into the new machine for the same user. Any help would be apperciated.

Thanks,

1

1 Answer 1

0

.OpenTextFile() the exported file ForReading, loop until .AtEndOfStream, .ReadLine() each line, Split() on vbTab, (check for plausibility), feed the two elements of the Split() array to .MapNetworkDrive.

You must log in to answer this question.