Link to home
Start Free TrialLog in
Avatar of jcain103
jcain103

asked on

VBScript hang at logoff with split tunnel vpn

I am troubleshooting a hang on a vbscript whichs runs at logoff when using a split-tunnel Cisco SSL vpn on a Windows Server 2003 domain.  The script loops through all possible mapped network drives (letters O through Z), enumerating and disconnecting the drives if mapped.  I use Cisco PIX Firewall, with both Cisco VPN client software and web-based SSL vpn.  The SSL vpn has split tunneling enabled so some lab machines can be reached.  I have enabled in Group Policy the Maximum Time to Wait for Scripts and set it to 45 seconds before ending the logoff.  This solves the problem of having remote users wait up to 10 minutes (600 second default before forcing logoff) to shut down their machines properly.  This hang happens with the ssl vpn connected or disconnected when the user logs off, but does not happen when using the vpn client (no split tunnel) in the same scenario.  Any ideas?

Thanks,
Jason
Avatar of Bradley Fox
Bradley Fox
Flag of United States of America image

Can you please post the function that removes the drive?  I'm thinking you may have to force it closed due to hanging open files.
Avatar of jcain103
jcain103

ASKER

Set obj_Network = WScript.CreateObject("WScript.Network")
Set obj_FSO = CreateObject("Scripting.FileSystemObject")

      for i = 79 to 84
      ' If the drive letter is already in use then disconnect the drive
            If obj_FSO.DriveExists ( Chr(i)&":" ) Then
                  obj_Network.RemoveNetworkDrive Chr(i)&":"
            End If
      next
'we map the X drive as the user's home, thus skipping 85
for i = 86 to 90
      ' If the drive letter is already in use then disconnect the drive
            If obj_FSO.DriveExists ( Chr(i)&":" ) Then
                  obj_Network.RemoveNetworkDrive Chr(i)&":"
            End If
      next

 'Cleanup
Set obj_Network = Nothing
Set obj_FSO = Nothing

wscript.quit
ASKER CERTIFIED SOLUTION
Avatar of Bradley Fox
Bradley Fox
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could also use a bit simpler of a script to do this, but I don't think that's your real issue...this will unmap all network drives except "x:"


Set obj_Network = WScript.CreateObject("WScript.Network")
Set odrives = wNetwork.EnumNetworkDrives

For i = 1 To odrives.Count - 1 Step 2
      If Not odrives.Item(i-1) = "X:" Then
              obj_Network.RemoveNetworkDrive odrives.Item(i-1),True,True
        End If

Next
Didn't consider forcing the removal of the mapped drive.  As for the hanging open files, do you mean opened on the client's machine (e.g. my laptop while testing) from the mapped network share?  It hangs with or without ever exploring or opening the network share or any files on it.  I am almost positive it has something to do with the split vpn tunnel, that was my original reason for the post.  Will have to test this after hours and let you know.  (forgot that 85 is U, not X :)
Is this all the script does, or does it have some more functions in it?
That's the entire script.  Only other script is run at login to map the drives.  If I am at home, I have to start the vpn after I login to my machine to get on the network, thus the drives are never mapped.  I just looked at the 4 GPO's that are in place for this macine, and for me as a user - the code above is the only logoff scripting to remove mapped drives.