How do you fully and correctly re-name a hyper-v vm?

Jennifer MacDonald 0 Reputation points
2024-07-19T15:17:34.2166667+00:00

Update: I suppose I should be a little bit more clear, we are able to rename the vm but we want to ensure we go about correctly renaming the file structure not just the vm and vhdx files.

We are in the process of updating/upgrading servers. We moved from "oldvm" to "newvm" how do we correctly rename the vm in it's entirety? We don't just want to rename the machine we want to rename the file structure and everything.

This question is related to the following Learning Module

Windows Training
Windows Training
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Training: Instruction to develop new skills.
26 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Zunhui Han 2,550 Reputation points Microsoft Vendor
    2024-07-19T15:59:53.3433333+00:00

    Hello,

    Thank you for posting in Q&A forum.

    To rename the virtual machine in Hyper-V, you can open PowerShell on the host and run the following command to modify it. The bold part should be changed according to your actual environment.

    Rename-VM VM1 -NewName VM2

    Renames virtual machine VM1 to VM2.

    For details, you can refer to the following link:

    https://learn.microsoft.com/en-us/powershell/module/hyper-v/rename-vm?view=windowsserver2022-ps

    I hope the information above is helpful.

    Best regards

    Zunhui

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.
    0 comments No comments

  2. Marcin Policht 26,465 Reputation points MVP
    2024-07-19T15:35:48.7566667+00:00

    Combine the approach described in https://community.spiceworks.com/t/hyper-v-moving-renaming/709905 with https://www.deploymentresearch.com/renaming-vhdx-files-for-hyper-v-vms/


    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.