We use a naming scheme at work for our computers. The name starts with (L for laptop, D for desktop, M for mac) and then the asset tag for the device.
We are in the process of setting up AnyConnect for our users and need to check if it is installed and install it it if it is not.
So I’m thinking check if the computername starts with “L” (case doesn’t matter) and then check if AnyConnect is installed. If not, then install and copy the XML file to the location for the settings file goes.
The XML file would be copied to C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile after the program installs.
Please refer the script for installing “anyconnect” software depending on the computer name. If the name starts with D/d or L/l, script will proceed otherwise it says "computer is not in the working scheme"We have attached the script for installing the software on windows(desktop and laptop) & MAC device separately.
script which need to run in the terminal is given below.
Save this code as “filename.sh” format and run the code using following command. Example : “sudo sh filename.sh”.
In this script you can modify the parameter
Edit parameters:
“url=https://www1.aps.anl.gov/files/it/Remote-Access/VPN/downloads/AnyConnect/anyconnect-macosx-i386-3.1.13015-k9.dmgname=anyconnect-macosx-i386-3.1.13015-k9.dmg” #as your need before running the script.
#!/bin/bash
file=“/Applications/Cisco”
url="https://www1.aps.anl.gov/files/it/Remote-Access/VPN/downloads/AnyConnect/anyconnect-macosx-i386-3.1.13015-k9.dmg" #change url as your need
if [ -d /Applications/Cisco ]
then
echo "Cisco Anyconnect is installed."
else
echo "any connect is not installed"
curl -O $url
hdiutil attach anyconnect-macosx-i386-3.1.13015-k9.dmg
cp -r /Volumes/"AnyConnect 3.1.13015" /Applications
installer -pkg /Applications/"AnyConnect 3.1.13015"/Anyconnect.pkg -target / -allowUntrusted
rm -r /Applications/"AnyConnect 3.1.13015"
hdiutil detach /Volumes/"AnyConnect 3.1.13015"
fi