Reputation: 87
I have a hyperV server that I use to run a powershell script and one of the cmdlets is Get-VHD -Path "\\SERVER-A\folder\UVHD-profile.vhdx"
which tried to get info about a VHDX file from a remote serverA (which is the location of all the VHDX files).
If a run the (above) command locally on the hyperV server it runs successfully.
I now want to run the script from another serverB but the get-vhd
cmdlet requires a functioning installation of hyperV (not only the Powershell module) so I need to run it using Invoke-Command
. So I run this command on remote serverB:
Invoke-Command -ComputerName hyperV -ScriptBlock {Get-VHD -Path "\\SERVER-A\folder\UVHD-profile.vhdx"}
but i get an error saying the path doesnt exists (even though the path exists - I copy-pasted it).
interestingly, when I copy the VHDX file from the remote serverA to the hyperV server and run this command from serverB:
Invoke-Command -ComputerName hyperV -ScriptBlock {Get-VHD -Path "C:\user\desktop\UVHD-profile.vhdx"}
It works fine. It seems like it's not allowed to use the get-vhd
with a UNC path when you are using Invoke-command
Anybody knows how to overcome this? Am I missing something?
Thanks in advance.
Upvotes: 0
Views: 613
Reputation: 338
This is commonly known as the double-hop issue. Essentially, you're hopping from computer A, to computer B, then to computer C, and the authentication isn't passed on from B to C.
This Microsoft Documentation article describes the issue in more detail and lists several ways to address it.
Upvotes: 2