I'm trying to reinstall an old and buggy cluster with server 2012 standard. In order to free that, I need to migrate all VMs to a new cluster. Unfortunately, 'Migrate roles..' does not work, my colleague and I spend hours looking for a solution and we finally
abandoned that route. Now, I'm trying to manually migrate them to a scale-out file server with a powershell script.
For a single vm the logic is as follows:
Get-ClusterResource -Cluster Ctr-old -Name "Virtual Machine test-vm" | Stop-ClusterResource
Get-VM -ComputerName srv-old-01 test-vm | Export-VM -Path "\\srv-new-vm\VMS\export_vms"
Import-VM -Path "\\srv-new-vm\VMS\export_vms\test-vm\Virtual Machines\793E[...]4090.XML"
Add-ClusterVirtualMachineRole -VirtualMachine test-vm
Get-ClusterResource -Cluster Ctr-new -Name "Virtual Machine test-vm" | Start-ClusterResource
Running this script on srv-old-01 is not an option.
Executing this on srv-new-01 raises on error on line 2:
Export-VM : Failed to create export directory with error 'General access denied error'(0x80070005): test-vm
(793EA5A0-7BF3-4942-9FC8-BAB471CB4090).
You do not have permission to perform the operation. Contact your administrator if you believe you should have
permission to perform this operation.
At line:1 char:55+ Get-VM -ComputerName srv-old-01 test-vm | Export-VM -Path "\\srv-old-01 ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : PermissionDenied: (Microsoft.HyperV.PowerShell.VMTask:VMTask) [Export-VM], Virtualizatio
nOperationFailedException+ FullyQualifiedErrorId : AccessDenied,Microsoft.HyperV.PowerShell.Commands.ExportVMCommand
The security settings for srv-new-vm\VMS\export_vms allow full read/write access to everyone. I tried adding the hyper-v security id, but something is off here as well:
C:\> icacls \\srv-new-vm\VMS\export_vms /grant "NT Virtual Machine\793EA5A0-7BF3-4942-9FC8-BAB471CB4090":(f)
NT Virtual Machine\7F80A5A0-7BF3-4942-9FC8-BAB471CB9B42: No mapping between account names and security IDs was done.Successfully processed 0 files; Failed processing 1 files
I also noticed that on the folder on srv-old-01, where the vms are currently stored, there is an additional "Virtual Machines" user that has "special permissions". I don't know how to replicate that on the new server.
Any thoughts on what might be wrong with the permissions?
Cheers,
MaartenD