Guest Services in Hyper-V and Copy-VMFile

Русская версия/Russian version

Windows Server 2012 R2 provides a lot of updates and improvements to Hyper-V. The most visible change is the new guest service “Hyper-V Guest Service Interface” or just “Guest Services”, which disabled ,by default in the properties of every VM on 2012 R2 Hyper-V.
This service has a really modest functional, but extremely useful. Guest Services allows you to copy the necessary files between the host (server Hyper-V, on which are placed the target VMs = parent partition) and virtual machines (= child partition) without any load on the network components. The copying process is provided by link between Hyper-V host and VM through vmbus (Virtual Machine Bus).hv_arch
Also, the vmicguestinterface service (from the virtual machine side) responsible for functionality integration service components  on the guest OS level.   Altogether,  we  have got native feature for point-to-point (for example, host 1 VM in the DMZ) or multi-point (host VMs) copying necessary files between Hyper-V partitions

Before using this new feature you have to check:

1) Hyper-V Integration services must be up-to-date. Version has to be at least 6.3.9600.16384.

Get-VM | Select Name, IntegrationServicesVersion

2) Guest Services enabled for target VMs

#Gets current VM configuration
Get-VM|Get-VMIntegrationService|ft VmName,Name,Enabled -AutoSize
#Enabling Guest Service
Get-VM | Enable-VMIntegrationService -Name "Guest Service Interface"

3) vmicguestinterface service must be running inside the guest OS

Get-Service vmicguestinterface


Service management is provided by only one cmdlet  Copy-VMFile ((Microsoft.HyperV.PowerShell.GuestServiceInterfaceComponent) , which has a list of required parameters:

-SourcePath = what we want to copy (UNC is supported!)
-DestinationPath = where we want to save files
-FileSource = file source type
-VMName   = VM names


#Copies 2012R2.ISO file from file source HOST to VM with name Server 2012R2_1 and saves files to pre-created folder C:\ISO on guest OS
Copy-VMFile "Server2012R2_1" -SourcePath C:\ISO\2012R2.iso -DestinationPath C:\ISO\2012R2.iso -FileSource Host

If you don’t have pre-created destination path – you will get error. To automate process of creation necessary files you have to use -CreateFullPath  parameter that checks and creates folders, if they are not exist.

Copy-VMFile "Server2012R2_1" -SourcePath C:\ISO\2012R2.iso -DestinationPath C:\ISO\2012R2.iso -FileSource Host -CreateFullPath

Process of copying:


Final result:copyvmfile_3



4 thoughts on “Guest Services in Hyper-V and Copy-VMFile”

  1. Hi mate,

    what did you do to get the source as UNC work?
    I got exceptions:
    Copy-VMFile : ‘VMName’ failed to copy file. (Virtual machine ID 39C130C0-51AD-4A7A-A9DE-347AA7BF71BC)
    ‘VMName’ failed to copy files to the guest: General access denied error (0x80070005). (Virtual machine ID 39C130C0-51AD-4A7A-A9DE-347AA7BF71BC)
    ‘VMName’ failed to copy the source file ‘\\sharepath\tmp\kb3069115_WorkerInstaller_x64.msp’ to the destination ‘D:\tmp\kb3069115_WorkerInstaller_x64.msp’ in the
    guest: General access denied error (0x80070005). (Virtual machine ID 39C130C0-51AD-4A7A-A9DE-347AA7BF71BC)
    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:1
    + Copy-VMFile -ComputerName $VM.VMHost -Name VMName -SourcePath …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : PermissionDenied: (Microsoft.Hyper…FileToGuestTask:VMCopyFileToGuestTask) [Copy-VMFile], VirtualizationOperationFailedException
    + FullyQualifiedErrorId : AccessDenied,Microsoft.HyperV.PowerShell.Commands.CopyVMFileCommand

    I set the source UNC path permission as Everyone has Full permission for both Share permission and NTFS permission. It’s still throwing this error.

    Can you please give me some advice?


    1. Looks like it only works when you run the command directly from host, but not working if you run it from other server by using Copy-VMFile -ComputerName or Invoke-Command -ComputerName etc…

      1. Hi, River Yang!
        Have you solved your issue? What type of error are you receiving after Copy-VMFile -ComputerName or ICM?

        I guess there is the only 1 right way to copy file to VMs -only from the original host or just use Copy-VmFile GUI if you want to copy multiple files ( + both ways should work with -ComputerName parameter as well.
        That’s by design (but I have not check your scenario yet). + as I know, there are a lot limitations and “bugs” when you use ICM (especially, as a part of scripts in VMM or etc).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: