VBS Delete Text from File ?
Posted on 2006-03-20
I have a VBS script that creates a VPN connection on the system. Works great. What I want to do now is create another script that will remove that VPN connection that I just created. To do this I want to be able to delete certain text from the rasphone.pbk file. Anyone have any idea how to do this ? Below is the an example of what I am doing to create the connection, all I need to be able to do is the reverse.
Dim filesys, vpnfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set vpnfile= filesys.OpenTextFile("C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk", 8)
vpnfile.WriteLine "[New VPN Connection]"
How can I go back into that text file and Remove those lines I just created ? Any help would be greatly appreciated. Thanks!