Add Connection Profiles to Cisco AnyConnect Secure Mobility Client

I enjoy the new VPN client, it’s small and fast, however I hated that you can’t save profiles in the drop down list like you could in the traditional VPN client.

VPNNoProfile

This has been bothering for a long time and kept finding conflicting information on if this was possible or not. Finally got it to work.

VPNProfiles

This is for version 3.1x and Windows 7 let me know if this works for your version and OS.

  • Create a preferences.xml file in C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\
  • Use this format
<?xml version="1.0" encoding="UTF-8"?> <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/">
<ServerList>
     <HostEntry>
          <User>dclouduser</User>
          <SecondUser></SecondUser>
          <ClientCertificateThumbprint></ClientCertificateThumbprint>
          <ServerCertificateThumbprint></ServerCertificateThumbprint>
          <HostName>dCloud</HostName>
          <HostAddress>dcloud-rtp-anyconnect.cisco.com</HostAddress>
          <Domain></Domain>
          <Group>ssl_url</Group>
          <ProxyHost></ProxyHost>
          <ProxyPort></ProxyPort>
          <SDITokenType>none</SDITokenType>
          <ControllablePreferences>
          <LocalLanAccess>true</LocalLanAccess></ControllablePreferences>
     </HostEntry>      <HostEntry>
          <User>dmacias</User>
          <SecondUser></SecondUser>
          <ClientCertificateThumbprint></ClientCertificateThumbprint>
          <ServerCertificateThumbprint></ServerCertificateThumbprint>
          <HostName>Speech-Soft</HostName>
          <HostAddress>vpn.dmacias.com</HostAddress>
          <Domain></Domain>
          <Group>ssl_url</Group>
          <ProxyHost></ProxyHost>
          <ProxyPort></ProxyPort>
          <SDITokenType>none</SDITokenType>
          <ControllablePreferences>
          <LocalLanAccess>true</LocalLanAccess></ControllablePreferences>
     </HostEntry>
</ServerList> </AnyConnectProfile>
  • Save the file.
  • Restart the connectivity client.
  • Enjoy

~david

EDIT 01/18/2017: This also works with Cisco AnyConnect 4.x!

49 Comments

  1. Greg
    Thank you! This had been driving me crazy - I needed to replace my exisiting servers with a new one. I had been typing in the address manually every time. These instructions fixed my issue.
    1. dmacias
      Glad to hear it worked for you!
  2. Dario
    Not working for me in a XP
    1. dmacias
      What happens when you try this on XP?
  3. keeky
    add profile.xml same path also works, however, no idea why username can not be remembered。。。
  4. dmacias
    The username should save also. Did you use the format above?
  5. Siraz
    Thank you.. It has been driving me crazy for a long time to replace with a new connection. Appreciate!
  6. Dreal
    I also noticed that there was persistent entry in anyconnect after using your workaround. The persistent entry was found one directory up in the global preferences xml. Thank you for this how-to!
    1. dmacias
      Glad to hear it worked for you, good tip on the persistent entry.
  7. Torben
    Same problem here. Username is taken from last connection and not from the xml file?
  8. Diego
    It also working for me to load HostName and HostAddress, but not the user. It keeps getting the username from the tag in C:\Users\(user)\AppData\Local\Cisco\Cisco AnyConnect Secure Mobility Client\preferences.xml Any idea why it works like that? Thanks!
    1. dmacias
      No, I've not had a chance to play with it to see if the username can be retrieved based on the drop down.
  9. Kaash
    Thanks a ton !!!!!!! :-) worked for me in Win 7
  10. Jim
    So did anyone get the username to be retrieved based on drop down? That seems to be cached and cannot get to work. Any help appreciated.
  11. Igor
    Having same issue with user. It keeps remembering user from different profile
  12. RickM
    I'm using MS Visual Studio Tools for Applications to edit the profile xml and it tells me that USER is an invalid child element for in namespace http://schemas.xmlsoap.org/encoding
    1. dmacias
      Rick, User is not going to do anything for you. You'll only be able to save the connection address.
  13. RickM
    The original posted answer showed: dclouduser ssl_url I do get a drop down using: dCloud dcloud-rtp-anyconnect.cisco.com I was hoping user and group would also come up when selecting hostname from the drop down. That looks like what everyone was asking about. Is there no way to get username and group from an xml?
    1. dmacias
      Yeah seems like username and group don't come from this file, which is a shame.
  14. RickM
    So, did CISCO provide a way for use to have user and group or any other user attributes associated with a hostname?
  15. Igor
    Thanks a lot for the help! I was trying to find solution couple days already, and yours work!!! How did you find it yourself man? I do not see it in Cisco official f@king docs )
    1. dmacias
      I suspect I ran across it on the support forums, honestly it's been forever. Certainly something Cisco should look into implementing as this seems to be my most popular post. Glad it helped you out.
  16. JimC
    Thanks for posting! Works with version 3.1.x and Windows 10. Like others, this has saved a lot of frustration in what seems like a simple thing of remembering connection info.
  17. JR
    I know it is old but was also very helpful to me. Thanks for posting. (Windows10)
  18. AndresC
    This does not work for me with version 4.2.01022 on Windows 7 Pro SP1. The last session does not work for me by default. I also do not even have a profile directory. I created one and added the xml file, but that did not work unfortunately.
    1. dmacias
      I'll check out your version and see if I can get it to work. Thanks for the update.
    2. dmacias
      AndresC, unfortunately I don't have access to AnyConnect 4.x. Sorry.
    3. dmacias
      Actually look at tomfreakz reply, his 4.x client works on Mac, so maybe it should work on Windows too.
  19. tomfreakz
    Sorry, please delete my previous comments. Hi, I’m using mac, with Cisco AnyConnect 4.3.03086 To add new profile, I just create new xml file under directory /opt/cisco/anyconnect/profile/ I name it myprofile.xml Then inside my xml file, you may type your connection name and ip address, inside this xml tag. You may look on my codepen. Looks like this blog comment doesn’t allow html/xml tag script http://codepen.io/tomfreakz/pen/WRwOBE It works on my mac. What about you? :)
  20. David
    Thank you so much. This saved me a lot of frustration.
  21. Thomas
    @tomfreakz: Hey, just tried your solution for Mac but unfortunetaly this doesnt work for me. It simply does not appear in the VPN drop down menu. Any clue?
  22. quantum
    Thanks dmacias &amp; tomfreakz, this site was extremely helpful. I've confirmed tomfreakz's solution works for Mac OS (Sierra) with Cisco AnyConnect client v4.2
  23. Fer M
    It worked for me. Thank you sir!
  24. Philip S
    Thank dmacias I'm using it with AnyConnect 3.1 on a Windows 10 1703 Client and it works great for me Philip
    1. dmacias
      Excellent news man!
  25. Cassandra
    Hey sorry for the newbie question, I&#8217;m not a coder. Can you highlight the areas where I plug the two URLs for the two profiles? This seems simple enough if I know what to replace, but the one URL at the beginning is throwing me off. What goes there? (http://Schemas&#8230;) Thank you.
    1. dmacias
      Cassandra, Look at the following two lines inside of the XML block: &lt;HostName&gt;Speech-Soft&lt;/HostName&gt; &lt;HostAddress&gt;vpn.dmacias.com&lt;/HostAddress&gt; Let me know if this doens't help.
  26. Rick Melton
    I have 2 URLs working, but each has a different group and username. Is there a way to get those to come up when I select that URL.
    1. dmacias
      I've looked but there isn't.
  27. Rick Melton
    Bummer!
  28. Eugene
    Directory to place profiles.xml at Linux OS is the same as Mac’s: /opt/cisco/anyconnect/profile/
  29. Chuck
    Dmacias – great solution on Win 7. thanks so much. Let us know when you figure out how to bring in the username!
  30. Akileo
    The username may need to use %username% in order to bring the current username in use in Windows (or it may need to be added manually between the tags
  31. Rick
    I&#8217;ve tried both USER and USERNAME tags, neither worked. The AnyConnectProfile.xsd does not show a tag to specify a user. :(
  32. lystra
    I don’t have the profile folder as describe in the cisco anyconnect folder, how do i create one?
    1. dmacias
      Any chance it's hidden?
  33. rprado
    I just want to thank you guys for the threads which helped me with anyconnect. A especial thanks to tomfreakz for sharing how to write a concise anyconnect xml profile. Thank you.
  34. Saharablue
    Brilliant thank you!!!!!
  35. Anonymous
    This worked for me on Windows 10 and Cisco Client 4.2. Thanks for posting this.