1

How do I create dial-up connection on windows from the command line?

By "create" I do not mean how to establish an existing connection, but how to create a new dial-up connection. The common way is to use the new connection wizard (GUI), but I want to create (and delete) the connection from the command line (script).

I want to create the dial-up connection only when needed, because if no internet connection is available windows pops up a dialog asking to connect using the dial-up connection, which blocks programs requesting a connection. This does not happen if the dial-up connection does not exist. Disabling the "default connection" setting on the dial-up connection does not prevent the dialog to pop up.

Adam
  • 43
  • 1
  • 3
  • As to your second paragraph, I specifically remember an option "Never dial a connection" only available from Internet Settings in Control Panel, or IE's right-click menu. It was not reachable from a Dial Up Networking connection setting window, nor modem properties. – Marcos Feb 27 '14 at 17:57
  • like so: http://superuser.com/a/435817/110335 – Marcos Feb 27 '14 at 18:21

2 Answers2

1

Have you seen Microsoft's own page about setting up (creating) a dial-up connection using rasphone.exe?

http://support.microsoft.com/kb/555935

How to setup dial-up connection by rasphone.exe command
Click Start, type rasphone -a in the Start Search box, and then press Enter key.
Click Dial-up button on the How do you want to connect page.
Type the telephone number and destination name(e.g. Dial-Up), on the Type the telephone number to connect to page, click Next button to continue.
Type your user name and password, and make sure the Remember this password check box has been selected, on the Type your user name and password page, click Create button to continue.
Click Start, type rasphone -e <destination name> in the Start Search box, and then press Enter key.
Note: you must use the destination name which typed in step3, for example, Dial-Up. 
On the Options tag of the Dial-up Properties, Clear the following selection:
a. Prompt for name and password, certificate, etc.
b. Include Windows logon domain.
c. Prompt for phone number.
then click Ok button.

The trouble I see here is that it still involves clicking. This may not be your dream solution, but for those parts, you could create a short AutoHotkey script (or for the whole process, for that matter).

Marcos
  • 4,796
  • 5
  • 40
  • 64
0

Take a look at rasdial which can create a dial-up connection based upon the arguments you provide.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Thanks, but rasdial _cannot create_ a new dial-up connection. With rasdial you can establish (or shut down) an already existing dial-up connection and optionally supply a new phone number or user credentials, but it's not possible to create a new dial-up connection. – Adam Jan 07 '12 at 19:10