When you attempt to use a VPN (Virtual Private Network) connection on a Windows Server 2003 computer, you receive a message similar to:

Error 633 - the modem (or other connecting device) is already in use or is not configured properly.

This behavior will occur if TCP port 1723, which VPN uses to establish a connection, is being used by another program.

To resolve this issue, you must:

  • Reserve TCP port 1723.
  • Identify and kill the program that is currently using TCP port 1723.
  • Restart your Windows Server 2003 computer. This may cause the program to use a different port.

I have scripted FixVPN.bat to assist you in this task. When you open a CMD.EXE window on your Windows Server 2003 and type FixVPN, the script will:

  • Add 1723-1723 to the ReservedPorts Value Name, a REG_MULTI_SZ data type, at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.
  • Use netstat -aon to determine the process that is using TCP port 1723.
  • Prompt you to kill the offending process.

FixVPN.bat contains:

                              @echo off                              setlocal                              set key=HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters                              call :getRP>nul 2>&1                              @echo reg add %key% /V ReservedPorts /T REG_MULTI_SZ /D "%ReservedPorts%" /F                              reg add %key% /V ReservedPorts /T REG_MULTI_SZ /D "%ReservedPorts%" /F                              @echo.                              @echo Proto  Local Address          Foreign Address        State           PID                              for /f "Tokens=*" %%a in ('netstat -aon^|FIND "TCP "^|FINDSTR /L /C:":1723 "') do (                               set line=%%a                               for /f "Tokens=4,5" %%b in ('@echo %%a') do (                                if "%%c" EQU "" call :TK %%b                                if "%%c" NEQ "" call :TK %%c                               )                              )                              endlocal                              goto :EOF                              :getRP                              set ReservedPorts=##                              for /f "Tokens=3" %%a in ('reg query %key% /V ReservedPorts ^|FIND "\0\0"') do (                               set ReservedPorts=%%a##                              )                              if "%ReservedPorts%" EQU "##" set ReservedPorts=1723-1723&goto :EOF                              set ReservedPorts=%ReservedPorts:\0\0=\01723-1723%                              set ReservedPorts=%ReservedPorts:##=%                              goto :EOF                              :TK                              @echo %line%                              :TK1                              set /P ans=Do you want to kill PID %1^? Reply Y or N.                               if /i "%ans%" EQU "N" goto :EOF                              if /i "%ans%" NEQ "Y" goto TK1                              taskkill /PID %1 /F