Option 2: connectd P2P initiator using a simple script (Windows PowerShell)

Overview

The script p2p.ps1 automates some of the tasks needed to make a repeatable P2P connection to a single Service. This script is intended to demonstrate show to create P2P connections in Powershell. In general, if you are running Windows and wish to manage P2P connections, you should install the remoteit Desktop and use that.

 

Download the script

Download the attached p2p.zip file, then extract the p2p.ps1 script to the same folder where you downloaded connectd.exe on your system.

Edit the following values in p2p.ps1 as needed, then save the file.

  • uid - the UID of the Service you are connecting to.  How do I find this?
  • port - any number between 33000 and 65535
  • address - localhost, usually 127.0.0.1, but can be any 127.x.y.z where x, y, and z are less than or equal to 255

Run the script

Run:

.\p2p.ps1

The script will interactively request the username and authhash for your remote.it account. 

How do I get my account authhash?

The script starts up and if everything was entered correctly, you'll see something similar to:

mceclip0.png

This script runs connectd in the background so that you can continue to use the command prompt, and after about 10 seconds, shows you the command you can use to kill the connection when you are done. The value shown in the Powershell "Stop-Process" command is the process ID (PID) of the connectd daemon which was just launched.

mceclip0.png

 

If you used "powershell" on the command line rather than being inside powershell, then simply run:
powershell Stop-Process <pid>
as shown:
mceclip1.png

 

To use the connection for ssh, type:

mceclip2.png

The syntax for other applications will depend on the specifics of those applications.

 

Warning

This example is very simple and is intended to launch a single P2P connection at a time. If you have more elaborate needs, you will need to enhance the script accordingly.

Was this article helpful?
0 out of 0 found this helpful