Extension Attributes to get Cisco AnyConnect Version

ChadL3
New Contributor II

Alright so I'm trying to create an Extension Attribute to get the version of Cisco AnyConnect on the machines. But I'm getting blank results, I setup Skype the same way and it seems to work fine. Does something look wrong?

Data Type: String
Inventory Display: Extension Attributes
Input Type: Script


!/bin/sh

if [ -f "/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app/Contents/info.plist" ] ; then VERSION=$( defaults read "/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app/Contents/info.plist" CFBundleShortVersionString )
else VERSION="Not installed"
fi

echo "<result>$VERSION</result>"


1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

OK, I see. You may not be aware of this, but there is one possible way to do this without needing an Extension Attribute.

If you do a standard computer Advanced Search and use the criteria of "Application Title" is or has "Cisco AnyConnect Secure Mobility Client.app", once you run the search, you can then begin to export the results.
On the screen where it asks you "Choose the inventory item on which to base your results", you can choose "Applications" instead of the default "Computers" option.

When the export completes, what this gives you is a csv file that will have the computer results sorted in a way that all devices that have specific versions of the app installed get grouped together. It still shows each machine, but there will be a main column with the app and application version that they are under, so to speak. You kind of have to see it to understand what I mean.

This may or may not give you what you want. Some people don't like the way those exports come out. They can sometimes be a little difficult to use in external tools, but it's worth at least looking at it to see if it's an option for you.

View solution in original post

7 REPLIES 7

rlandgraf
Contributor

You are missing the # in the first line.

!/bin/sh

Unless you just missed it in your copy

mm2270
Legendary Contributor III

Out of curiosity, why would such an Extension Attribute be needed? I have Cisco AnyConnect Secure Mobility Client installed on my Mac, and the version is captured natively by the jamf binary.

a67b6378a5594acb8822819b2cfa5f50

ChadL3
New Contributor II

I missed the # in my paste here

ChadL3
New Contributor II

mm2270, I'm trying to get it to display in an Inventory report so I can export all the versions to a spreadsheet

mm2270
Legendary Contributor III

OK, I see. You may not be aware of this, but there is one possible way to do this without needing an Extension Attribute.

If you do a standard computer Advanced Search and use the criteria of "Application Title" is or has "Cisco AnyConnect Secure Mobility Client.app", once you run the search, you can then begin to export the results.
On the screen where it asks you "Choose the inventory item on which to base your results", you can choose "Applications" instead of the default "Computers" option.

When the export completes, what this gives you is a csv file that will have the computer results sorted in a way that all devices that have specific versions of the app installed get grouped together. It still shows each machine, but there will be a main column with the app and application version that they are under, so to speak. You kind of have to see it to understand what I mean.

This may or may not give you what you want. Some people don't like the way those exports come out. They can sometimes be a little difficult to use in external tools, but it's worth at least looking at it to see if it's an option for you.

bradtchapman
Valued Contributor II

@ChadL3 : when pasting code into Jamf Nation, you need to put three backticks before the first line and after the last line of code.

Example:
```
#!/bin/bash
Line 1
Line 2
Line 3
```

Becomes:

#!/bin/bash
Line 1
Line 2
Line 3

WaqasKhan
New Contributor II

Here's another way of getting AnyConnect version, grabbing it from vpn stats output.

#!/bin/bash

anyConnectVersion=$(/opt/cisco/anyconnect/bin/vpn stats | grep "Cisco AnyConnect Secure Mobility Client" | awk -F"[()]" '{print $2}')

if [[ "$anyConnectVersion" != "" ]]; then
        echo "<result>$anyConnectVersion</result>"
else
        echo "<result>Not installed</result>"
fi