[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/06/2009 at 02:16PM PST, ID: 24879482
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

No Error, Nothing

Asked by hoshie329 in VB Script

The code below is a combination of the help i have received here and what i could find on the internet, the script works well. all part work on their own.

the problem I am having is that the Z: drive never maps, I have checked at the command line with Net Use. I also do not receive any errors.

I don't even know if that portion of the script is running it is lines 72 though 80

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
Option Explicit 
Dim Shell, objShell, strCommand, strHost, ReturnCode, oShell
Wscript.Sleep 10000
Do
' Verify conection to internet, loop until connection established
          'Host or IP to ping
          strHost = "google.com"
          'Create shell object
          Set Shell = wscript.createObject("wscript.shell")     
          'What to run in command line
          strCommand = "ping -n 3 -w 3000 " & strHost
          'Run command and get return code
          ReturnCode = Shell.Run(strCommand, 0, True)
          '0 = pingable, 1 = no response
     If ReturnCode = 0 Then
    'Ping Cisco ASA in Florida
                'Host or IP to ping
                  strHost = "vpnts.l1esd.com"
                   'Create shell object
                     Set Shell = WScript.CreateObject("WScript.Shell")
                     'What to run in command line
                     strCommand = "ping -n 3 -w 3000 " & strHost
                    'Run command and get return code
                    ReturnCode = Shell.Run(strCommand, 0, True)
                  '0 = pingable, 1 = no response
               If ReturnCode = 0 Then
               'If response, establish remote session to Florida ASA
                  'Starts IIS Cisco VPN Connect on System Boot ("C:\Program Files\Cisco Systems\VPN Client\vpnclient.exe" connect vpnts4.l1esd.com)
                    Set objShell = WScript.CreateObject("WScript.Shell")
                      strCommand = Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\vpnclient.exe" & Chr(34) & " connect " & strHost
                    'set objexec = objshell.exec(strCommand)
                   ReturnCode = objShell.Run(strCommand, 0, False)
               Else
               'If no response Establish FAILOVER session to Illinois
                  'Starts FAILOVER IIS Cisco VPN Connect on System Boot ("C:\Program Files\Cisco Systems\VPN Client\vpnclient.exe" connect FAILOVER)
                    Set objShell = WScript.CreateObject("WScript.Shell")
                     strCommand = Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\vpnclient.exe" & Chr(34) & " connect FAILOVER"
                    'set objexec = objshell.exec(strCommand)
                   ReturnCode = objShell.Run(strCommand, 0, False)        
               End If
            ReturnCode = 0
     Else
                  'wscript.echo strHost & " is Disconnected"
                    ReturnCode = 1
                  Wscript.Sleep 2000
     End If
Loop Until ReturnCode = 0
'ping to verify vpn connection loop until response
Set oShell = CreateObject("Shell.Application")
Do
          'Host or IP to ping
            strHost = "10.165.165.35"
             'Create shell object
               Set Shell = wscript.createObject("wscript.shell")     
                'What to run in command line
                strCommand = "ping -n 3 -w 3000 " & strHost
              'Run command and get return code
             ReturnCode = Shell.Run(strCommand, 0, True)
           '0 = pingable, 1 = no response
         If ReturnCode = 0 Then
             'on response map Y: drive
             Call MapDrive("Y:","\\10.165.165.35\EnrollmentData","genericlso","genericlso")
                oShell.NameSpace("Y:").Self.Name = "EnrollmentData" 
                WScript.Quit
             ReturnCode = 0
         Else
             ReturnCode = 1
             Wscript.Sleep 2000
         End If
Loop Until ReturnCode = 0
'Check Default Gateway, Map Z: Drive Accordingly
If DefaultGateway = "172.16.32.1" Then
             Call MapDrive("Z:","\\172.16.32.100\fpfiles","fptech","Fptech!")
                oShell.NameSpace("Z:").Self.Name = "fpfiles" 
                WScript.Quit
         Else
             Call MapDrive("Z:","\\10.165.165.200\fpfiles","fptech","Fptech!")
                oShell.NameSpace("Z:").Self.Name = "fpfiles" 
                WScript.Quit            
End If   
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
Sub MapDrive(sDrive,sShare,sUser,sPass)
        On Error Resume Next
        Dim WSHNetwork
        
        Set WSHNetwork = WScript.CreateObject("WScript.Network")
        WSHNetwork.RemoveNetworkDrive sDrive, 1, 1
        WScript.Sleep 300
        Err.Clear
        WSHNetwork.MapNetworkDrive sDrive, sShare, "False", sUser, sPass
        if cStr(err.number) = "-2147023677" then
                msgbox err.description
        end if
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Function DefaultGateway
DefaultGateway = Empty
Dim oDG, oDGs, WMI
Set WMI = GetObject("winmgmts:\\.\root\cimv2")
Set oDGs = WMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each oDG In oDGs
If Not IsNull(oDG.DefaultIPGateway) Then
If Not oDG.defaultIPGateway(0) = "0.0.0.0" Then
DefaultGateway = oDG.DefaultIPGateway(0)
Exit For
End If
End If
Next
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
[+][-]11/06/09 02:29 PM, ID: 25763639

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 02:35 PM, ID: 25763683

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 02:39 PM, ID: 25763707

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 02:47 PM, ID: 25763757

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 02:50 PM, ID: 25763772

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 03:07 PM, ID: 25763878

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 03:40 PM, ID: 25764058

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: VB Script
Sign Up Now!
Solution Provided By: lciprianionut
Participating Experts: 2
Solution Grade: A
 
 
[+][-]11/06/09 05:30 PM, ID: 25764553

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_3_20080625