Cookie
Electronic Team, Inc. uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

How to Access COM Port in Hyper-V: A Complete Guide

Editorial Team Editorial Team
Updated: Jan 7, 2025
Hyper-V offers no native support for allowing a host's physical serial or COM ports to pass through guest virtual machines (VMs) directly. This is why accessing physical COM ports in Hyper-V is challenging. This impacts applications running in a VM that need to communicate directly with the serial devices connected to the host machines.

You can resolve this issue using:

  • Serial over Ethernet Connector (SEC) method: A SEC is third-party software that lets you share a host's physical COM ports with a VM over a network. Serial port direction becomes effortless with the software’s intuitive, user-friendly interface.

  • Native Hyper-V method: Using this method, you can redirect COM ports via Remote Desktop Protocol (RDP) using built-in functionalities, such as Enhanced Session Mode for Windows-based guest machines.

Or, you can take another approach, but it's complex. You can create virtual serial ports in the VM using PowerShell commands and configuring named pipes.

The two Hyper-V COM port access methods are both viable but come with their own set of pros and cons. So, choose what works the best for you. Let's now discuss the two methods in detail to help you make that decision.

Contents:


  1. Method 1: Accessing Physical COM Ports via SEC
  2. Method 2: Enable Serial Port via Native Hyper-V Modes
  3. Final Recommendation

Method 1: Accessing Physical COM Ports via SEC

Serial over Ethernet Connector (SEC) is a software solution that enables easy serial ports sharing between a guest and a host machine or over a network.

logo
Serial to Ethernet Connector
4.9 Rank based on 372+ users reviews
Try for Free Free Trial available for 14 days
usb to remote desktop

How to Configure Serial over Ethernet Connector for Hyper-V Serial Ports:

Prerequisites:

  • Software: Serial over Ethernet Connector on both the guest and host machines
  • Guest VM: Its operating system supports serial communication.
  • Host Machine: It's a Windows-based machine with Hyper-V installed on it.
  • Physical COM Port: Available on the host machine

Step 1: Download and Install SEC

Download and Install SEC
Go to the official website and download the Serial over Ethernet Connector (SEC) on your host machine. Run the Installer program with administrative privileges, follow the instructions.

Step 2: Share the COM Port

Share the COM Port
  • Launch the Serial over Ethernet Connector software on the host computer. Establish a connection by finding the button "New connection" and clicking on it. Next, choose the option "Server connection".

  • Select the physical COM port that you want to share over a network. Identify it by name, like “COM6” and choose it. Define connection name: Provide a descriptive name for the new connection. It could be something like “Server COM6”, that you find easy to understand.

  • Set up TCP/IP settings: Specify the IP address of your host machine. It could look something like 127.0.0.1 (four numbers separated by periods) for local connections. Next, define the Port Number (example: 5000).

Note: To secure your connection and data, you can enable cybersecurity mechanisms, such as authentication, authorization, and encryption.


  • Locate the option "Create" and click on it to initiate the connection and share your physical COM port.

Step 3: Install SEC on the Guest VM

Open the Hyper-V Manager. Now, right-click on your VM and choose the option "Start". Download and Install the SEC: Follow the same instructions as given in Step 1.

Step 4: Connect to COM Port

Connect to COM Port
  • Open the software Serial over Ethernet Connector in your VM. Create a new client connection: Locate the option "New connection" and click on it. Next, choose "Client connection".

  • Configure Client Connection by defining remote host and port number: Enter the host computer's IP address. If your VM has host-only networking or NAT, use 127.0.0.1. Next, enter the port number specified in the server connection. Example: 5000

  • Define the name of the COM port that you need to create in the virtual machine. Example: COM6. Set up the connection by looking for the option "Create" and click on it.

  • Once you've set up the connection, it's important to verify it to ensure the connection is reliable and you're good to perform the tasks. To enable this, open Device Manager in your VM and expand "Ports (COM & LPT)". Ensure the list has the new virtual COM port (example COM6).

Step 5: Configure and Test

  • Adjust Serial Communication settings on the virtual machine. Inside Device Manager, right-click on the virtual COM port and then on "Properties". Here, you can modify settings like parity, baud rate, data bits, stop bits, etc. based on the requirements of your serial device.

  • In your VM, run the application that needs to use the COM port. After this, start enabling COM ports in Hyper-V VMs and let the application use it.

  • Connect the serial devices to the physical COM port of the host machine. To ensure if the connection is properly set, perform data transfer tests.
Try Serial over Ethernet now
14-day free trial

Pros and Cons: Using Serial over Ethernet Connector with Hyper-V

Using the software Serial over Ethernet Connector with Hyper-V comes with certain pros and cons. Let's explore them.

Pros:

  • Easy to use interface
    You can easily access and share Hyper-V serial ports with Serial over Ethernet Connector even without deep technical skills as its graphical user interface (GUI) is highly intuitive and user friendly.

  • Advanced functionalities
    You'll get plenty of advanced functionalities and features in the software to make connectivity, accessibility, and data transmission a smooth ride. You can customize connection settings parameters like baud rate, data bits, stop bits, etc. easily.

  • Support for multiple operating systems
    SEC works seamlessly with both Linux and Windows-based guest machines.

  • Direct COM port sharing
    You can directly share the host machine’s physical COM port to virtual machine.

  • Regular updates
    The vendor releases regular updates to improve the software’s functionality, security, usability, and other aspects.

  • Reliable support
    You'll get professional support should any issues come up and you need assistance.

Method 2: Enable Serial Port via Native Hyper-V Modes

You can use native Hyper-V methods to enable serial port. This process doesn't involve any third-party software solutions.

Unlike other virtualization solutions, Hyper-V doesn't allow a physical COM port to pass through directly. So, if you want to establish connection between the serial port of a host machine and a VM, you have the option to use some built-in features, such as Enhanced Session Mode and Named Pipes. Let's see how this works step-by-step instructions to achieve this.

Prerequisites

  • Host machine: It has Windows as its operating system with Hyper-V installed in it.
  • Guest VM: It runs a compatible Windows-based operating system (especially for features like Enhanced Session Mode to work).
  • Physical COM Port: It's available on your host machine.
  • Administrative privileges: Enable admin privileges on both your guest and host machines.

Mode 1: Using Enhanced Session Mode

NOTE: The Enhanced Session Mode works with only those Windows-based guest machines supporting Remote Desktop Protocol (RDP). Here's how this method works:


Step 1: Enable Enhanced Session Mode on the Host

Go to the Start menu on the host computer. Search and open Hyper-V Manager.

Enable Enhanced Session Mode Policy:

  • Choose your Hyper-V host machine from the left pane.
  • Next, look for “Actions” in the right pane and find and click on the Hyper-V Settings located under it.
  • Find Enhanced Session Mode Policy under Server settings. Click on it.
  • Check the box that says "Allow enhanced session mode".
  • Click on OK.

Enable Enhanced Session Mode for User:

  • In the same Hyper-V Settings window, find the option Enhanced Session Mode. Click on it.
  • Check the box that says "Use enhanced session mode".
  • Click on OK.

Step 2: Configure COM Port Redirection Settings

In your VM, start Configuring serial ports in Hyper-V settings for redirection. Start the VM: Go to the Hyper-V Manager. Now, right-click on your VM and choose “Connect”. In the VM connection window, you'll see a “Start” button. Click on it.

Adjust resources: In the connection window, look for "Show Options”. Click on it before you log into the VM.

  • Go to "Local Resources"
  • Under Local devices and resources, find and click on "More..."
  • Expand "Ports"
  • For the COM ports you wish to redirect, you'll find boxes next to them. Check the boxes
  • Click on OK.

Login to your guest machine.

Step 3: Verify the COM Port in the Guest OS

Open Device Manager: Press Windows Key + X together and choose Device Manager from it. Check for all the redirected COM ports by expanding "Ports (COM & LPT)". It should contain entries such as COM1, COM2, etc.

Test the COM Port: Test the COM port by using serial communication software, such as Advanced Serial Port Terminal, PuTTY, etc.

Pros and Cons of Implementing Enhanced Session Mode


Implementing the Enhanced Session Mode features comes with certain pros and cons that you must be aware of before you choose this method.

Pros:

  • Cost-effective
    The method uses native Windows and Hyper-V features, eliminating additional software expenses.

  • Straightforward configuration
    You can configure it effortlessly via the Hyper-V Manager settings.

  • Security
    For secure resource redirection, it uses Windows security models.

Cons:

  • Supports only Windows
    It supports only Windows systems, thus, it won't work for you if you use other operating systems.

  • Limited functionality
    In non-RDP environments and during VM boot-ups, it doesn't allow serial communication. In addition, its functionality or performance may not be as good as direct COM port access.

Enhanced Session Mode is better for users with basic needs, relying on Windows, and looking for cost-free options.

Mode 2: Using Named Pipes

This Hyper-V serial port method uses Named Pipes and requires you to configure the settings manually. It works on both Linux and Windows guest computers. Here's how to use it:

Step 1: Use PowerShell to Add a COM Port

In your VM, you'll need to add a COM port. Open PowerShell as Administrator: Locate the Start menu and right-click on it. Choose Windows PowerShell with admin privileges.

Add a COM Port: On the VM, Run this command:

Add-VMComPort -VMName "YourVMName" -Number 1 -Path \\.\pipe\HyperVSerialPort

NOTE:

Replace your VM’s name in - "YourVMName", where:

      Number → COM port number (inside the VM)
      Path → Named pipe (connecting the VM's COM port)


Test if the new COM is added, run this command:

Get-VMComPort -VMName "YourVMName"

Also, make sure you add the port properly.

Step 2: Configure the Named Pipe on the Host

  • On the host, connect to the named pipe by using the application - Hyper-V Virtual Machine Connection. It's because Windows doesn't have a native functionality to connect a physical serial or COM port to a named pipe.

  • But if you want to redirect the physical COM port to the named pipe, you'll need a different approach. For example, you can perform physical redirection over TCP/IP - Windows doesn't offer native support for it without additional software or scripting.

  • Alternatively, use a built-in tool or PowerShell scripts to create a Serial to TCP/IP bridge if the application supports connecting to a network socket. This however exceeds native functionalities.

Pros and Cons of Using Named Pipes for Serial Port Access in Hyper-V


Using named pipe for Serial Port Access in Hyper-V comes with some pros and cons:

Pros

  • Saves costs
    The tool offers native Windows features, so you don't have to buy extra software.

  • Cross-compatible
    It supports both Windows and Linux guest machines.

Cons

  • Complexity
    The tool can be complex to set up as you need to configure it manually and may add some additional scripts to be able to connect the physical COM port to the VM using a named pipe.

  • Lacks native support
    Connecting physical COM ports to named pipes is not natively supported. You'll need extra workarounds to achieve that.

  • Stability
    Built-in functions are more reliable and stable than customized solutions.

Named pipes method is preferable for those with technical expertise in coding, handling configurations, and troubleshooting. It's good for people who can dedicate enough time for these activities and are looking for cost-effective options.

Final Recommendation

Users looking for an easier, less complex, and more reliable way to connect your host and guest machines via COM ports can choose Serial over Ethernet Connector. Although it needs investment, the cost will balance the advantages you get in terms of time and money savings, effortless setups, and professional support when in need.

However, if you face budget constraints in purchasing the software, you may go for native Hyper-V methods. Consider this method if you've technical skills to deal with named pipe setup complexities and write additional scripts if needed. It's also a viable solution if you work in Windows-only environments.

Serial to Ethernet Connector
Access remote serial port over IP Network for Windows
14-day Free Trial available
License price starts at $259.95
Available for