Adam
Adam

Reputation: 53

how-to create a windows dial-up connection from the command line

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.

Upvotes: 2

Views: 6294

Answers (2)

Marcos
Marcos

Reputation: 4930

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).

Upvotes: 1

Alex K.
Alex K.

Reputation: 175876

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

Upvotes: 0

Related Questions