The previous post had us run a script on a machine prior to it being replaced during an equipment refresh. This script follows that one and should be run on the new system.
Group Policy creates a mapping to the user's home directory using the z: drive as used below.
The following script maps drives based on the mappings gathered and placed in the mappings.csv file created in the previous post.
On Error Resume Next
Dim objNetwork
Dim strDriveLetter, strRemotePath
dim fs,objTextFile
dim arrStrset
Const ForReading = 1
boolPersistent = True
FileName = "z:\newsys\mappings.csv"
set fs = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("WScript.Network")
set objTextFile = fs.OpenTextFile(FileName, ForReading)
Do while NOT objTextFile.AtEndOfStream
arrStr = split(objTextFile.ReadLine,",")
drive = arrStr(0)
path = arrStr(1)
objNetwork.MapNetworkDrive drive, path, boolPersistent
Loop
objTextFile.Close
set objTextFile = Nothing
set fs = Nothing
WScript.Quit
Copy this script into notepad and save with a .vbs extension.
No comments:
Post a Comment