Hyper-V. Перенос файлов ВМ в другое расположение с помощью Powershell.

Перенос файлов ВМ в другое расположение с помощью Powershell.

Move-VMStorage "Test VM" -DestinationStoragePath D:\TestVM

Перемещает все файлы виртуальной машины “Test VM” в D:\TestVM

PS C:\> Move-VMStorage "Test VM" -VirtualMachinePath D:\TestVM\Config -SnapshotFilePath D:\TestVM\Snapshots -SmartPagingFilePath D:\TestVM\SmartPaging -VHDs @(@{"SourceFilePath" = "C:\TestVM\Disk1.VHDX"; "DestinationFilePath" = "D:\TestVM\Disks\Disk1.VHDX"}, @{"SourceFilePath" = "C:\TestVM\Disk2.VHDX"; "DestinationFilePath" = "D:\TestVM\Disks\Disk2.VHDX"})

Перемещает все файлы виртуальной машины “Test VM” в разные расположения в папке D:\TestVM.

Перенос файлов ВСЕХ ВМ из одной папки в другие с названиями виртуальных машин:

Get-VM |
Where-Object { $_.Path -eq 'D:\Hyper-V\Hyper-V Replica' } |
ForEach-Object {
    $MoveOptions = @{
        'Name'                   = $_.Name
        'DestinationStoragePath' = 'D:\Hyper-V\{0}' -f $_.Name
    }
    Move-VMStorage @MoveOptions
}

Ссылки

https://serverfault.com/questions/964400/using-a-replica-vm-as-main-vm-on-replacement-server-hyper-v

https://learn.microsoft.com/en-us/powershell/module/hyper-v/move-vmstorage?view=windowsserver2025-ps

Оставьте ответ

Ваш адрес email не будет опубликован.

60 ÷ = 6