I have a logon script that I am really stumped on.
This code worked for well over 2 years and has not been changed. Suddenly it has randomly stopped working on computers in my domain. Some are W2k some are XP. The script sends me no errors even when I try to turn on error catching. I think it may have to do with some security MS has changed with some pathces latetly but I need to know how to work around it. Here is the code I uses:
Any idea's would be helpful. Thanks.
This code worked for well over 2 years and has not been changed. Suddenly it has randomly stopped working on computers in my domain. Some are W2k some are XP. The script sends me no errors even when I try to turn on error catching. I think it may have to do with some security MS has changed with some pathces latetly but I need to know how to work around it. Here is the code I uses:
Code:
Sub MapDrive(strDrive,strShare)
On Error Resume Next
For i = 0 to oDrives.Count - 1 Step 2
If oDrives.Item(i+1) = strShare Then
strStatus = strStatus & vbCRLF & strDrive & strShare & " already mapped."
i = oDrives.count
strMappedDrives = strMappedDrives & strDrive & " "
ie.document.all.Msg2.InnerText = strMappedDrives
Exit Sub
Else
WSHNetwork.MapNetworkDrive strDrive, strShare, "TRUE"
If Err.Number Then
Err.Clear
WSHNetwork.RemoveNetworkDrive strDrive
WScript.Sleep 2000 ' Allow drive to finish unmapping.
WSHNetwork.MapNetworkDrive strDrive, strShare, "TRUE"
If Err.Number <> 0 Then 'IF there is still an err then hold IE
ie.document.all.holdit.checked = True
Else
IE.Document.all.holdit.checked = False
End If
End If
End If
Next
strMappedDrives = strMappedDrives & strDrive & " "
ie.document.all.Msg2.InnerText = strMappedDrives
strStatus = strStatus & vbCRLF & strDrive & strShare & " " & Err.Description
' use to troubleshoot Err.Number
' MsgBox(Err.Number)
' MsgBox(Err.Description)
End Sub
Any idea's would be helpful. Thanks.