cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
194
Views
0
Helpful
1
Replies

Delete VPN XML profiles on client

Hi,

Is there any way to delete certian VPN XML profiles by AnyConnect using some "on connect" scripts or might some other method for Windows OS? I have tried "onconnect" vbs script but it seems not working. I suspect admin rights are required to perform delete action.

ON ERROR RESUME NEXT
Err.Clear

Set objShell = CreateObject("WScript.Shell")
objShell.LogEvent 0, "Delete vpn.xml file on first time connect OnConnect script."

Set obj = createobject("Scripting.FileSystemObject")
Dim filename
filename="C:\ProgramData\Cisco\Cisco Secure Client\VPN\Profile\vpn.xml"
obj.DeleteFile filename
Set obj=Nothing

If Err.Number <> 0 Then
objShell.LogEvent 0, "Failed to delete autopilot.xml" & vbCrLf & Err.Number & ": " & Err.Description
End If

WScript.Quit

1 Reply 1

ccieexpert
Level 1
Level 1

yes that directory needs admin rights.. how are you installing new software etc ? any of the software update tools are having admin priviliges and you can delete the profiles using that... i am not sure if you can elevate your privileges from a script programatically never tried that..