Find physical host name of Hyper-V VM machine

Navneeth Singh VA 0 Reputation points
2024-07-15T09:53:50.9866667+00:00

I have a hyper v vm which I used to access remotely. By mistake I changed the gateway and now I am unable to access. I forgot in which server this VM is created in. Is there any way I can change the gateway or get to know the hostname of the server where this VM is created in?

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,627 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Marcin Policht 18,010 Reputation points MVP
    2024-07-15T11:59:13.74+00:00

    Use the IP address assigned to the VM and track it on the network level - to the Hyper-V virtual switch


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


  2. Josip Jurišić 1 Reputation point
    2024-07-15T22:12:51.79+00:00

    If you're new to PowerShell and need to change the gateway address of a Hyper-V VM, follow these steps. It'll be easier for you to understand what are you doing:

    1. Open PowerShell as Administrator from Hyper-V machine:
    • Click on the Start menu, type PowerShell, right-click on Windows PowerShell, and select Run as administrator.
    1. Find the VM Network Adapter:
    • First, you need to know the network adapter's name for your VM. Use the following command to list the network adapters of your VM:

    Get-VMNetworkAdapter -VMName "YourVMName"

    • Replace "YourVMName" with the name of your virtual machine. This command will show you the network adapters connected to the VM.
    1. Get the Current Network Configuration:
    • To see the current IP configuration of the network adapter, use:

    Get-VMNetworkAdapter -VMName "YourVMName" | Get-VMNetworkAdapterConfiguration

    • This will display the current IP settings, including the gateway.
    1. Change the Gateway Address:
    • Use the following command to change the gateway address:

    Set-VMNetworkAdapterGateway -VMName "YourVMName" -Gateway "NewGatewayAddress"

    • Replace "NewGatewayAddress" with the new gateway address you want to set.
    1. Verify the Changes:
    • After changing the gateway, you can verify the new settings by running the Get-VMNetworkAdapterConfiguration command again:

    Get-VMNetworkAdapter -VMName "YourVMName" | Get-VMNetworkAdapterConfiguration


    If my answer helped you, please click on "Accept Answer" to help others in the community easily find the solution. Thank you!

    0 comments No comments