Loading...

Converting Cisco AnyConnect stats (vpncli.exe stats) to a PowerShell Object

1 A+ A-


In this post I will show you how to convert result of vpncli.exe stats to a PowerShell object in order to be able to use easily properties.


Context

You have Cisco AnyConnect and want to get information about VPN connectivity.

For that you can use the below vpncli.exe with parameter stats.

This can be used as below:

The result will be as below:


As you can see it's not really easy to use it to search a specific property.

For instance you want to know if connection state is connected or not, or you want to get the duration.

See below those properties from the stats command:



The solution

We will convert the stats results to a PowerShell object, this way we will be able to get Connection state or duration or others easily.

See below the command line to convert stats result to a PowerShell object:

See below the result:


Now let's try to get connection state:

Or duration or session disconnected:

vpncli.exe stats 630975036775169000

Enregistrer un commentaire

1 commentaire

Anonyme a dit…

Hi,
Thanks for the page - it was very helpful.
Just FYI - Cisco has since changed the folder name 'Cisco AnyConnect Secure Mobility Client' to 'Cisco Secure Client'. It may help to denote this in your code.

Accueil item

Award

Sponsors

Learn KQL in one month

You want to support me ?

Mes articles en français

Books in French


Stats