RASPHONE - CMD


Overview

RASPHONE is a command-line utility in Windows operating systems that manages Remote Access Service (RAS) connections. It allows users to dial and manage network connections defined in the Network Connections folder. Primarily, it is used for managing VPN and dial-up network connections programmatically or via batch files, making it an essential tool in networking and system administration tasks.

Syntax

The basic syntax for the RASPHONE command is:

RASPHONE [-f FileName] [Options] entryname

Parameters:

  • -f FileName: Specifies the phonebook file to use. If this parameter is omitted, RASPHONE uses the default phonebook.
  • entryname: The name of the phonebook entry to dial or manage.

Options:

  • -d: Dial a connection.
  • -h: Hang up a connection.
  • -r: Replace phonebook entry details.
  • -e: Edit phonebook entry.
  • -a: Add new phonebook entry.
  • -x: Remove phonebook entry.
  • -v: View phonebook entry details.

Options/Flags

  • -d: Initiates a dial-up or VPN connection. Requires the name of the entry.
  • -h: Hangs up the specified connection. Used when you need to programmatically disconnect.
  • -r: Modifies an existing phonebook entry. Useful for changing settings within an automation script or batch job.
  • -e: Displays a dialog box for editing the specified phonebook entry. Useful for configurations that require user input.
  • -a: Opens a dialog box to add a new phonebook entry. This can be used when setting up new connections.
  • -x: Deletes a phonebook entry. Use this with caution, as it will permanently remove the specified entry.
  • -v: Views details of a specified phonebook entry, providing a straightforward way to inspect settings or configurations.

Examples

  1. Dialing a VPN Connection Named ‘WorkVPN’:
    RASPHONE -d WorkVPN
    
  2. Hanging up a Connection Named ‘WorkVPN’:
    RASPHONE -h WorkVPN
    
  3. Editing an Entry Named ‘WorkVPN’:
    RASPHONE -e WorkVPN
    
  4. Adding a New Phonebook Entry:
    RASPHONE -a
    
  5. Deleting an Entry Named ‘OldConnection’:
    RASPHONE -x OldConnection
    

Common Issues

  • Connection Does Not Exist: If you specify an entry that does not exist or is misnamed, the command will fail. Ensure correct spelling and presence in the phonebook.
  • Permission Issues: Running certain commands may require administrative privileges especially when modifying or deleting entries.
  • System Dialogs: Using options like -e or -a can invoke GUI dialogs, which may not be suitable for automated scripts.

Integration

RASPHONE can be combined with other CMD commands or batch scripts to automate network setup and disconnection processes. For instance, scheduling tasks with schtasks to connect a VPN during specific times, or using shutdown after a successful connection to perform updates:

RASPHONE -d WorkVPN
shutdown /r /t 300
  • NETSH: This command provides scripting capabilities to manage network configurations which can be useful alongside RASPHONE.
  • PING: Testing connectivity after establishing a connection with RASPHONE.

For further details, you can refer to the official Microsoft documentation on RASPHONE as well as community forums and tech support sites for troubleshooting advanced issues.