# Console connect requirements for imported VMs

Hybr lets you connect to a VM using console connect. To make use of this feature, a set of pre-requisites needs to be followed. One of the main requirements is to assign ports to the VM properties. This is done automatically by Hybr for VMs created from the Admin portal. In case, if you have imported one or more VMs, the ports have to assigned manually.&#x20;

For VMs not created from Hybr and imported using connection sync,  please follow the steps below.

There are 2 ways to assign the console ports to the imported VM’s.&#x20;

#### Single or a few VMs

1. Ports can be manually assigned for VMs one by one using Hybr Admin portal.&#x20;
2. VM needs to be stopped and started s VCenter requires this process to&#x20;

#### Bulk port assignments

1. PowerShell script can be used to bulk assign the ports for multiple VMs.&#x20;
2. VM needs to be stopped and stopped (This is a requirement from VCenter to make this port available for console connect).

{% hint style="info" %}
VM needs to be stopped and started. (This is a requirement from VCenter to make this port available for console connect).
{% endhint %}

### Option 1: Assign ports using Hybr portal

* Login to Hybr `Admin portal` :arrow\_right:`VConnect` :arrow\_right: `Connections` :arrow\_right: `VCenter`
* Drill down into the respective `Connection`
* Navigate to the `Virtual Machines` tab.&#x20;

![](/files/-MUIBfZq1CyJ6WmuzI2X)

* Click on the Edit button and provide available the Port number (port range between 1000-9999 and 50000 – 50999)&#x20;

![](/files/-MUIBkQzOFov_uQ1hSMA)

* &#x20;Restart the VM and try to connect using console connect option.&#x20;

### Option 2: PowerShell script to assign the ports for multiple VM's:&#x20;

To get all the available console ports, run the below command in PowerShell window (in Admin mode) where the VConnect Tools is present. AvailabeConsoleConnect.csv will be generated in the same directory.&#x20;

```
VCONNECT.EXE DownloadAvailableConsolePorts <connectionId:Int32> [/VConnectApiEndpoint:<String>] 
[/VConnectApiUserName:<String>] [/VConnectApiPassword:<String>]  
```

#### Example:&#x20;

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoVCDjvSJF03p2a5huX-3297984667%2Fuploads%2FNABMiW4iUORylRqGWNys%2Ffile.png?alt=media)

* Open the shared `AllocateVCenterRemoteConsoleConnectPorts-Updated.ps1` PowerShell script in notepad++ and give the required parameters as below.&#x20;

```
$HostServerName = '-Vcenter server name-' 
$HostServerPort = 443 
$username = '- Vcenter Username-' 
$password = '- Vcenter password-' 
$Cluster = '-CLUSTERNAME-' 
$Datacenter = '-DATACENTERNAME-' 
$csvFile = '- Path to AvailabeConsoleConnect.csv generated in previous step-' 
$outputcsvfile = 'Path to save the allocated ports for the VM in an output file'  
```

* Save the script and execute in PowerShell from the machine which has access to the VCenter.
* Restart the VMs.&#x20;
* Once restarted, perform 'Sync console ports' button in `Hybr` Admin `portal --> VConnect -->  Connections --> Choose a connection --> Console Ports tab.`&#x20;

{% hint style="info" %}
VM needs to be stopped and started. This is a requirement from VCenter to make this port available for console connect.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudassert.com/hybr/features/admin/hybr-resource-management/console-connect-requirements-for-imported-vms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
