SCVMM - Migrate Library virtual harddisks

Kristian Leth 16 Reputation points
2023-04-25T11:38:45.6433333+00:00

Hi, We have a lot of virtual harddisks in our VMM library, that is used for around 800-1000 templates, that we need to move to another storage location - but are struggling with how to do that.

I tried with the Powershell cmdlet Move-SCVirtualHardDisk, but got the error message - "Unable to move virtual hard disk. You can only move virtual hard disks that are connected to a virtual machine on a Virtual Server or Hyper-V host. (Error ID: 10615, Detailed Error: )".

I then tried through the GUI / VMM Console, but are unable to figure out how to do this properly.
Ive read somewhere that we have to export / import the .vhdx files, and then attach all the profiles to the import harddisks - but with around 1000 templates, that will take ages.
So how would you normally do this?
User's image

System Center Virtual Machine Manager
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasimTamboli 4,785 Reputation points
    2023-05-11T19:36:30.14+00:00
    To efficiently migrate library virtual hard disks in System Center Virtual Machine Manager (SCVMM) without manually exporting/importing VHDX files and reattaching profiles to each template, you can use the following approach:
    
    Offline Library Migration: This method involves offline migration of the virtual hard disks in the library. You'll need to follow these steps:
    
    a. Stop the SCVMM service: Temporarily stop the SCVMM service to prevent any conflicts during the migration process.
    
    b. Copy the virtual hard disks: Copy the virtual hard disks from the current storage location to the new storage location using a file copy tool or utility.
    
    c. Update the library shares: In the SCVMM console, navigate to the Library workspace and update the library shares to point to the new storage location.
    
    d. Update the virtual hard disk paths: Modify the paths of the virtual hard disks in the SCVMM database to reflect the new storage location. This can be done using SQL queries or PowerShell scripting against the SCVMM database. Ensure to back up the database before making any changes.
    
    e. Start the SCVMM service: Once the paths have been updated, start the SCVMM service.
    
    Verify and update templates: After completing the offline migration, you'll need to verify and update the templates to ensure they reflect the new storage location. You can use PowerShell scripting to iterate through the templates and update the virtual hard disk paths accordingly.
    
    For example, you can use the Set-SCVirtualTemplate cmdlet to update the virtual hard disk path for each template. Here's a sample PowerShell command:
    
    powershell
    Copy code
    Get-SCVirtualTemplate | ForEach-Object {
        $template = $_
        $template.VirtualHardDisks | ForEach-Object {
            $_.Path = $_.Path.Replace("OldStorageLocation", "NewStorageLocation")
        }
        Set-SCVirtualTemplate -VirtualTemplate $template
    }
    Replace "OldStorageLocation" with the previous storage location and "NewStorageLocation" with the new storage location.
    
    By following this approach, you can migrate the library virtual hard disks in SCVMM efficiently without the need for exporting/importing each VHDX file and reattaching profiles manually. It ensures that all templates referencing the virtual hard disks are updated with the new storage location.
    
    0 comments No comments