Rui Qiu's Tech Blog
← Back to all posts

February 2, 2023

Shell Script to Install Cisco Anyconnect VPN via Intune

There is an excellent article talks about how to deploy the Cisco Anyconnect VPN client via Intune:

https://maclovin.org/blog-native/2021/cge1p5lkn8xdyxz8bgcumg61u7davp

Basically :

  1. Add Cisco Team Identifier (DE8Y96K9QP)and Bundle Identifier(com.cisco.anyconnect.macos.acsockext) into the System Extension Profile inside Intune;
  2. Add WebContentFilter profile;
  3. Configure Install Choice XML file(by default, the Cisco AnyConnect VPN DMG file installs every component, with this configuration XML file, you can specify which component to install);
  4. Cisco AnyConnect profile( to set the configurations and VPN server info during the installation);
  5. Deploy the Cisco AnyConnect client package

Here is my shell script to download the PKG file, installation choice XML file, and XML profile injection.

#!/bin/bash
# Cisco Anyconnect VPN Client Install
# Rui Qiu
# 20230201

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root"
    exit 1
fi

cd /tmp
curl -o ./AnyConnect.pkg https://xxx.com/AnyConnect.pkg
curl -o ./vpn.xml https://xxx.com/vpn.xml
curl -o ./vpninstallchoice.xml https://xxx.com/vpninstallchoice.xml
installer -pkg AnyConnect.pkg -applyChoiceChangesXML vpninstallchoice.xml -target /
cp -f /tmp/vpn.xml /opt/cisco/anyconnect/profile/

rm ./AnyConnect.pkg
rm ./vpn.xml
rm ./vpninstallchoice.xml