My intention with this script is to re-map the user's drive mappings to a new server. We are retiring an old file server and copying user and community files to a new server. This script does a wonderful job of mapping drives if they have not been previously mapped and disconnecting previously mapped drives. It won't replace the old U: drive mapping with the new one; it only disconnects it and leaves it mapped to the old share. This is the script:
Dim objADSysInfo, objUser, objNetwork
Dim strComputer, strDriveUser, strDriveCC, strCNUser, strUserLogon
On Error Resume Next
strComputer = "TEAK"
strDriveUser = "U:"
strDriveCC = "L:"
Set objADSysInfo = CreateObject("ADSystemInfo")
strCNUser = objADSysInfo.UserName
Set objUser = GetObject("LDAP://" & strCNUser)
strUserLogon = objUser.sAMAccountName
Set objNetwork = WScript.CreateObject("Wscript.Network")
objNetwork.RemoveNetworkDrive strDriveUser, True
objNetwork.MapNetworkDrive strDriveUser, "\\" & strComputer & "\" & strUserLogon
objNetwork.RemoveNetworkDrive strDriveCC, True
objNetwork.MapNetworkDrive strDriveCC, "\\" & strComputer & "\Campus_Center"
Help with this would be great. Thanks in advance.