To simplify our current setup. We have SRV01, SRV02, and SRV03. All Windows Server 2016 with Hyper-V installed and joined to our domain. SRV01 host a shared folder "\\SRV01\VM-ONLINE-STORAGE\Test" All servers on same network subnet and their windows firewall is OFF.
My goal is to create a new VM remotely using Powershell from SRV02 to SRV03 using network shared folder for vm storage.
ON SRV02
New-vm -ComputerName SRV03 -MemoryStartupBytes 1GB -NoVHD -Generation 2 -Name TEST1 -Path "\\SRV01\VM-ONLINE-STORAGE\Test\"
I get the following error
New-vm : Failed to create a new virtual machine.
At line:1 char:1
+ New-vm -ComputerName SRV03 -MemoryStartupBytes 1GB -NoVHD -Generat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VM], VirtualizationException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.NewVM
At first, I thought this has to do with missing permissions. So I tested the following on SRV02 and SRV03 and it worked just fine.
ON SRV02 and SRV03
New-Item -Path "\\SRV01\VM-ONLINE-STORAGE\Test\" -Name "testing" -ItemType "directory"
The folder created successfully. So no extra permissions are needed because I am using a domain admin account for all of this which is local admin on all servers.
The only way to make it work remotely is to use local folder path located on SRV03.
ON SRV02
New-vm -ComputerName SRV03 -MemoryStartupBytes 1GB -NoVHD -Generation 2 -Name TEST1 -Path "D:\Storage\"
This works just fine but we need to use network path instead. How can I achieve that?
Please note, when the command is issued locally on SRV03, it works.
ON SRV03
New-vm -ComputerName SRV03 -MemoryStartupBytes 1GB -NoVHD -Generation 2 -Name TEST1 -Path "\\SRV01\VM-ONLINE-STORAGE\Test\"
Successfull.
What am I missing?
I got it fixed. It has something to do with AD delegation permission.
The below webpage helped me fix the issue.
https://argonsys.com/microsoft-cloud/library/hyper-v-authentication-in-windows-server-2016-for-managing-remote-hyper-v-servers-through-rsat/