I found this link, which seems more or less to answer the problem, though the Linux script above it worked rather better. I found that the process termination code towards the end didn't work properly, so I took it out and all was well. I also changed the service commands in line with the discussion below and finished up with:-
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "telnet 192.168.0.1~"
WScript.Sleep 1000
WshShell.SendKeys "admin~"
WScript.Sleep 1000
WshShell.SendKeys "admin~"
WScript.Sleep 2000
WshShell.SendKeys "wan set service pppoa_0_38_0_d --protocol pppoa --conntrigger manual~"
WScript.Sleep 12000
WshShell.SendKeys "~"
WScript.Sleep 1000
WshShell.SendKeys "wan set service pppoa_0_38_0_d --protocol pppoa --conntrigger always~"
WScript.Sleep 6000
WshShell.SendKeys "~"
WScript.Sleep 1000
WshShell.SendKeys "logout~"
WScript.Sleep 6000
WshShell.SendKeys "~"
WScript.Sleep 1000
WshShell.SendKeys "exit~"
You simply copy this to a file with a .vbs suffix, edit it to update the router's IP address, the log-in user and password, and the service name and protocol. For the latter you will need to log into telnet manually and type:
wan show service
In your cmd script, invoke the edited script with:
start [/wait] reconnect.vbs
Use /wait if you want the script to complete before you continue to the next command.
One problem I found is that if called while the router is on-line it leaves it in a disconnected state, but increasing the delay between the two service calls fixed this, and you may need to tweak this or some of the other delays.