SCCM 2012 - How to install AnyConnect VPN with SCCM 2012

If you need to install, with SCCM 2012, cisco Anyconnect 3.1.01065 at first you need to know that profiles files are at following path

%ProgramData%\Cisco\Cisco AnyConnect Secure Mobility Client\Profile

Silent installation string

msiexec /i “anyconnect-win-3.1.01065-pre-deploy-k9.msi”    /norestart /passive

You can get .msi file at following links:

http://vpn.managednetworks.net/vpn/

https://ftp.rush.edu/users/vpn-client/


Here is a .vbs script that test if program is installed, in case install it, copy settings file and verify that installation went well.

'*****************************************************************************
' Author : Alessandro Mazzanti
' Creation date : 12/01/2015
' Version : 1.00                                                                                 
' Running on OS : Windows 7
'*****************************************************************************
'Installa Irfan View

Option Explicit
On error resume next


'---------------------------------------------------------------------------------------------------
'------------------------------------Variables definitions--------------------------------------
'---------------------------------------------------------------------------------------------------

Const ForWriting = 2


Dim objFile                                                                    'Create log file
Dim objFSO, objFolder                                                  'Object filesystem
Dim windir                                                                      'windows folder
Dim WshShell, WshNetwork                                         'Create Shell Object
Dim strComputer                                                              'Local Computer
Dim objSoftware                                                                 'Object software installed
Dim colSoftware                                                                'collection software installed
Dim objWMIService                                                             'objectWMI
Dim folder                                                                    'Processes Collection
Dim prova, Data, Temp, strusername, strComputerName, strLogPath            
Dim boolCisco, strCisco



'---------------------------------------------------------------------------------------------------
'------------------------------------ISTANCES Definition------------------------------------
'---------------------------------------------------------------------------------------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set windir = objfso.GetSpecialFolder(0)
Set Temp = objfso.GetSpecialFolder(2)
Set WshNetwork = WScript.CreateObject("WScript.Network")



'---------------------------------------------------------------------------------------------------
'------------------------------------PROGRAMS----------------------------------
'---------------------------------------------------------------------------------------------------


'Sezione per ritrovare il nome del computer e l'username
strUserName = WshNetwork.UserName
strComputerName = WshNetwork.ComputerName

'path di destinazione dei log
strLogPath = "c:\windows\temp\" & strComputerName & "_" & strUserName & "_VPN_ESITO.log"
Set objFile = objFSO.CreateTextFile ( strLogPath, ForWriting)

objFile.WriteLine Now & " - Inizio Script"

strComputer = "."
boolCisco = False

'Verifica se la cartella è presente
'if objFSO.FolderExists("c:\vpn_install") <> True Then
'        Set objFolder = objFSO.CreateFolder("c:\vpn_install")
'End If

'verifica se la vpn non è già installata
Software_installato

If boolCisco = False Then
    'installa la vpn
    Installa_VPN
    'copia i file
    Copia
    Software_installato
End If

objFile.Close

Sub Copia

    Const OverwriteExisting = True
    objFile.WriteLine Data & " - Inizio copia file di settaggio"
    objFSO.CopyFile "\\...server...path\Packages\Cisco Anyconnect 3.1.01065\Profilo\AnyConnectProfile.xsd", "C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\AnyConnectProfile.xsd" , OverwriteExisting
    objFSO.CopyFile "\\...server...path\Packages\Cisco Anyconnect 3.1.01065\Profilo\Seves.xml", "C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\Seves.xml" , OverwriteExisting

    objFile.WriteLine Now & " - Copiati file locali della VPN"   

    if prova = 0 Then
        Data = Now
        objFile.WriteLine Data & " - Esito copia file effettuato con successo"

    else
        Data = Now
        objFile.WriteLine Data & " - Copia non effettuata con errore: " & prova
    End if
   
End Sub

Sub Installa_VPN
    'folder = "c:\vpn_install"
    objFile.WriteLine Now & " - Installazione VPN in corso..."
    prova = WshShell.Run ( windir & "\system32\msiexec.exe /i anyconnect-win-3.1.01065-pre-deploy-k9.msi /qn /norestart", 0, true)

    if prova = 0 or prova="3010" Then
        objFile.WriteLine Now & " - Esito Installazione VPN effettuata con successo"
    else
        objFile.WriteLine Now & " - Esito Installazione VPN NON effettuata con codice d'errore " & prova
        objFile.WriteLine "INSTALLAZIONE TERMINATA ANTICIPATAMENTE CON ERRORE IRREVERSIBILE"
        wscript.quit
    End if
   
    wscript.sleep 1000
    objFile.WriteLine Now & " - Fine Installazione VPN  - Sleep 5 minuti..."
End Sub

Sub Software_installato
    Data = Now
    boolCisco = false

    objFile.WriteLine Data & " - Interrogazione WMI in corso per vedere il software installato..."
        Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colSoftware = objWMIService.ExecQuery _
        ("Select * from Win32_Product")

    For Each objSoftware in colSoftware
        'descrizione del sw installato
        if Ucase(Trim(objSoftware.Name)) = Ucase("Cisco AnyConnect Secure Mobility Client") Then
            boolCisco = True
            strCisco = " - " & objSoftware.Name & " versione " & objSoftware.Version & " - PRESENTE"
        End If

    Next

    'test presenza Cisco e scrittura del relativo log
    Data = Now
    If boolCisco = True Then
        objFile.WriteLine Data & strCisco
    else
        objFile.WriteLine Data & " - Client Cisco AnyConnect Secure Mobility Client 3.1.05182 ASSENTE"
    End If
End Sub

Here you can find other links that you could find them useful:

http://www.cisco.com/c/en/us/td/docs/security/vpn_client/anyconnect/anyconnect31/administration/guide/anyconnectadmin31/ac02asaconfig.pdf

http://www.cisco.com/c/en/us/td/docs/security/vpn_client/anyconnect/anyconnect30/administration/guide/anyconnectadmin30/ac02asaconfig.html

...

<------other -----="" articles="" blogs="" related="">

...

SCCM 2012 - How to install AnyConnect VPN with SCCM 2012


Tips - Locating the Cisco AnyConnect Profiles


Linux - Creare un Gateway Server


Backup - Fare il backup delle connessioni di rete e VPN


Tips - Cisco VPN e Vodafone Connect Card


Tips - Cisco errore Secure VPN Connection terminated locally by the Client. Reason 440: Driver Failure.


Tips - Cisco VPN 5.0 e Windows 8