I am in the process of learning vb scripting but still not there yet to able to troubleshoot this VB script that suppose to delete existing drive mapping and then map fresh new drives. I am mapping drive to Windows 2003 and Windows 2008 server shares. Following are the errors\problems relates to this script. First of all I will confess that I did cut and paste couple of vb scripts from solutions presented at experts-exchange.com to find a working one for myself, so please bear with me when you go through it.
1. First, at this time I am running it on my PC as a test script by double clicking on it. It works intermittently. Sometimes it does not delete drives before mapping and sometimes I do not find all my drives.
2. I am mapping home drives using profiles in active directory. I like to know how I can map Home drive for individual using script.
3. Past weekend I ran a bigger test and use GPO to deliver mapping drives using this script. I saw my entire drives letters but there were missing server names along shares. E.g. instead of Ch data on Server1 (Server1)' (L:) I was getting Disconnected drive (L:) even though they were working, but when I try to disconnect them I got drive path not found message.
I may be asking too many things here. Please ask me questions if you are not clear. These are the problem I need to resolve before I try again next weekend. Thanks in advance.
' TwoMap.vbs - Map Network Drive to M: and P:
' Example of VBScript Mapping two drives in one script.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.6 - April 24th 2005
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4, strRemotePath5, strRemotePath6, strRemotePath7, strRemotePath8, colDrives,i
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4, strDriveLetter5, strDriveLetter6, strDriveLetter7, strDriveLetter8
strDriveLetter1 = "F:"
strDriveLetter2 = "G:"
strDriveLetter3 = "L:"
strDriveLetter4 = "P:"
strDriveLetter5 = "S:"
strRemotePath1 = "\\MainServer\APPS"
strRemotePath2 = "\\MainServer\DATA"
strRemotePath3 = "\\Server1\CH DATA"
strRemotePath4 = "\\Server1\Policies & Procedures"
strRemotePath5 = "\\MainServer\ITI"
Set objNetwork = CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
' Force Removal of network drive and remove from user profile
' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
If UCase(colDrives.Item(i)) <> "H:" Then
' Section which maps two drives, M: and P:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4
objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5
' End of Windows Logon Script Example