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

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.


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

Accueil item


Learn KQL in one month


You want to support me ?

Mes articles en français

Books in French