I have a customer that uses Cisco VPN Client. They are going to change ISP which means that they are going to change IP adresses. The VPN profiles today are set up using the IP so I found a VB script to edit the pcf file and a login script sample to execute it.
VB Script:
Const ForReading = 1
Const ForWriting = 2
strFileName = Wscript.Arguments(0)
strOldText = "Host=Old Address"
strNewText = "Host=New Address"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, strOldText, strNewText)
Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
objFile.WriteLine strNewText
objFile.Close
Login Script:
if NOT EXIST("\serverlogs$VPNfixed_" + @wksta + ".txt")
AT (16,21) "Fixing VPN Files... "
; Defining Logfile
$VpnLogfile="\serverlogs$VPNfixed_" + @wksta + ".txt"
; Fixing the files
IF EXIST("C:Program FilesCisco SystemsVPN ClientProfilesFILE.pcf")
Shell '%comspec% /c \servernetlogonfixvpn.vbs "C:Program FilesCisco SystemsVPN ClientProfilesFILE.pcf"'
Endif
IF EXIST("C:ProgramCisco SystemsVPN ClientProfilesFILE.pcf")
Shell '%comspec% /c \servernetlogonfixvpn.vbs "C:ProgramCisco SystemsVPN ClientProfilesFILE.pcf"'
Endif
; Writing loglines
Open(1,$VpnLogfile,5)
$Logline=@Date + "," + @time + "," + @Userid + "," + @wksta + @CRLF
writeline(1,$LogLine)
Close(1)
Endif
The login script has some logic checking if the update has been done before in which case it will be skipped. It will also create a logfile for checking which computers has been updated.