Debugging Scripts
From Windows NT in a Nutshell by Eric Pearce, O'Reilly and Associates, 1997
Unlike Windows 95, NT does not supply a "step through script" function that allows you to execute your script one line at a time and watch it interact with the remote system. When running .SCP scripts, it does pop up the terminal window as the script executes, but this usually exits too quickly for you to catch the reason for failures. DUN does offer a form of post mortem analysis by recording the interaction between the client (you NT machine running dial-up networking) and the server (the comm-server you are logging into) in a log file, called SYSTEM32RASDEVICE.LOG. You have to specifically enable logging in the Registry in order of this to work.
In KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesRasManParameters, change the value for Logging from 0 to 1. You do not need to reboot the system for this to take effect, just exit and restart Dial-Up Networking.
Try dialing the entry you are debugging. After it fails or terminates, examine the DEVICE.LOG file:
Remote Access Service Device Log 01/09/1997 09:54:55
----------------------------------------------------------
Port: Command to Device:
Port: Response from Device:netblazer login:
Port: Command to Device:eap
Port: Echo from Device :eap
Port: Response from Device:
Password:
Port: Command to Device:foo
Port: Echo from Device :
Lo
Port: Response from Device:gin incorrect.
Netblazer login:
The "Command to Device" lines are text being sent from your computer to the remote computer. The "Response form Device" is what the remote computer sends back. The "Echo from Device" is simply the text you are sending being echoed back by the remote device. The actual exchange would look like this:
Your Computer Remote Computer
--------------------------------------------------------
netblazer login:
eap
Password:
foo
Login incorrect.
The echo is normally turned on for everything except passwords. This is another holdover from human interaction, where you expect to see what you are typing. The "Login incorrect" message coming from the comm-server in the "Response from Device" indicates that either the username or password is incorrect and this is the reason the script is failing. Keep in mind that the DEVICE.LOG file may contain your password in clear-text (the password is "foo" in the example). If you are interested in purchasing the book Windows NT in a Nutshell. Go to http://www.oreilly.com/catalog/winnut/