[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.

07/27/2009 at 04:21PM PDT, ID: 24604717
[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!

9.1

Logon script for Cisco ASA or VPN Client

Asked by afernandez000 in Cisco PIX Firewall, Windows Networking, Windows Server 2008

Hello,

We are trying to get a logon script to work when users connect to our network via the Cisco VPN.  I have tried to run it via the VPN client 'application launcher' (I added the path to the vbs file).  It is a vbs script, so I am wondering if vbs will not work over the VPN, or if it is running before the computer is fully connected to the network (I tried pointing to the network share where it normailly resides).  I also copied the script locally and ran it via the VPN client application launcher, and it didn't work.

Does the script need to be a batch file?  Is there a better way to get this done?  Any input is much appreciated.  The script is below, thanks
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:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
' ########################################################################
'  Establishes map drives.
'  Assign to OU Group Policy under USER CONFIG, WINDOWS SETTINGS, SCRIPTS, LOGON SCRIPT.
'
'  This script will: 
'  (1) check if the drive is already connected and, if so, disconnect it.
'  (2) map the drive.
'
'  Arguments are as follows: 
'     MAPIT  DRIVE-LETTER as string,  PATH as string, USER as string, PASSWORD as string
'     (1) Do not specify colon in drive letter.
'     (2) Do not end path with a forward slash.
'     (3) If user and password are not required to establish map, then specify a zero-length string as follows:  ""
'
' Reference Microsoft info at:
' http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthmapnetworkdrive.asp
' ########################################################################
 
Dim objShell : Set objShell = CreateObject("Wscript.Shell")
 
objShell.Run "xcopy " & chr(34) & "\\climateworks.local\NETLOGON\Template\normal.dotm" & chr(34) & " " & chr(34) &  "%USERPROFILE%\Application Data\Microsoft\Templates" & chr(34) & " /Y /I /Q"
 
 
' Create the Shell or environment for the commands:
Set WshShell = WScript.CreateObject("WScript.Shell")
' Define objects:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives()
 
'Get Username to map to HOME drive
LPHSUser = WshNetwork.UserName
' ====================================
' DEFINE WHO TO CONTACT for pop-up messages:
' ====================================
strContactMessage = "If you require assistance, please contact itsupport@bando.com."
 
' ==================
' DEFINE DRIVES TO MAP:
' ==================
Mapit "W", "\\FS1\Shared", "", ""
Mapit "U", "\\FS1\Users\" & LPHSUser, "", ""
'TO MAP TO HOME DRIVE USE: Mapit "K", "\\aphrodite\users\" & LPHSUser, "", ""
'ALSO NAME HOME FOLDER TO CORRESPONDING USERNAME
 
' Your printers somewhere around here...
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\FS1\XeroxPhaser3500"
WshNetwork.AddWindowsPrinterConnection "\\Fs1\ColorXeroxPhaser8560"
WshNetwork.AddWindowsPrinterConnection "\\Fs1\Xerox_7328_MFP"
WshNetwork.AddWindowsPrinterConnection "\\Fs1\XeroxPhaser3600_FAR"
'WshNetwork.SetDefaultPrinter "\\FS1\XeroxPhaser3500"
 
' ========
' CLEAN UP:
' ========
Set WshShell = Nothing
Set WshNetwork = Nothing
Set oDrives = Nothing
 
' ##################################
' DO NOT MODIFY ANYTHING BELOW THIS POINT...
'   unless you are familiar with the proper settings.
' ##################################
Sub Mapit(strLetter, strPath, strUser, strPass)
 
    ' Define the DriveLetter:
    DriveLetter = strLetter & ":"
 
    ' Define the remote path:
    RemotePath = strPath
 
    ' Pop-up Notices (set to False to disable notices, otherwise set to True):
    bPopReminder = False
 
    ' Define known errors to trap:
    Dim arrErrCode(1)
    Dim arrErrDesc(1)
    arrErrCode(0) = -2147023694
    arrErrCode(1) = -2147024811
    arrErrDesc(0) = "Unable to map drive " & DriveLetter & " to " & RemotePath _
        & " due to a previously defined remembered map with the same letter." _
        & vbCrLf & vbCrLf & "Please MANUALLY disconnect map drive " & DriveLetter _
        & ", then Log Out and Log back in."
    arrErrDesc(1) = "Unable to map drive " & DriveLetter & " to " & RemotePath _
        & " since " & DriveLetter & ": was previously reserved by your computer." _
        & vbCrLf & vbCrLf & "(Refer to Management, Shared Folders, Shares)"
 
    ' Define whether the map information should be removed from the current user's profile:
    bForceRemoveFromProfile = True
    bRemoveFromProfile = True
 
    ' Define whether the map information should be stored in the current user's profile:
    bStoreInProfile = False
 
    ' Check if already connected:
    AlreadyConnected = False
    For i = 0 To oDrives.Count - 1 Step 2
        If LCase(oDrives.Item(i)) = LCase(DriveLetter) Then AlreadyConnected = True
    Next
 
    ' Attempt to map the drive.  If already mapped, first attempt disconnect:
    If AlreadyConnected = True then
        WshNetwork.RemoveNetworkDrive DriveLetter, bForceRemoveFromProfile, bRemoveFromProfile
        If Not strUser = "" Then
            WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile, strUser, strPass
        Else
            WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile
        End If
        If bPopReminder Then WshShell.PopUp "Drive " & DriveLetter & " disconnected, then connected successfully to " & RemotePath
    Else
        On Error Resume Next
        If Not strUser = "" Then
            WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile, strUser, strPass
        Else
            WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile
        End If
        If Err.Number <> 0 Then
            bKnownError = False
            For I = LBound(arrErrCode) To UBound(arrErrCode)
                If Err.Number = arrErrCode(I) Then
                    bKnownError = True
                    strPopMessage = arrErrDesc(I)
                    ' Display the Disconnect Network Drives window:
                    If Err.Number = arrErrCode(0) Then
                        Set objWSH = Wscript.CreateObject("WScript.Shell")
                        objWSH.Run "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL Disconnect", 1, true
                    End If
                    Exit For
                End If
            Next
            If Not bKnownError Then
                strPopMessage = "Unable to map drive " & DriveLetter & " to " & RemotePath _
                    & " due to reason stated below."
            End If
            ' Display warning message:
            'strPopMessage = "WARNING!!   WARNING!!   WARNING!!   WARNING!!" _
            '    & vbCrLf & vbCrLf & strPopMessage _
            '    & vbCrLf & vbCrLf & Err.Description & " (error " & Err.Number & ")" _
            '    & vbCrLf & vbCrLf & strContactMessage
            'WshShell.PopUp strPopMessage
        Else
            If bPopReminder Then WshShell.PopUp "Drive " & DriveLetter & " connected successfully to " & RemotePath
        End If
    End If
 
    ' Release resources:
    Set objWSH = Nothing
 
    ' Slight pause to ensure each pass has time to commit:
    wscript.sleep 200
End Sub
 
Keywords: Logon script for Cisco ASA or VPN Cli…
 
Loading Advertisement...
 
[+][-]07/27/09 05:31 PM, ID: 24957048

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

Zones: Cisco PIX Firewall, Windows Networking, Windows Server 2008
Sign Up Now!
Solution Provided By: plimpias
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07/28/09 07:04 AM, ID: 24960728

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.

 
[+][-]07/28/09 11:47 AM, ID: 24963672

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.

 
[+][-]07/28/09 12:19 PM, ID: 24964080

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...
20091111-EE-VQP-91 - Hierarchy / EE_QW_4_20070622