Jul 31 2017

Print this Post

PowerShell Function: Copy-VMFolder

Hyper-V in Windows Server 2016 and Windows 10 came with some very cool features that makes interacting with VMs easier than ever. The ability to copy files into a VM directly from host is such a blessing. The Hyper-V Module now includes the cmdlet copy-VMFile which can copy any “File” from the host to a running VM.

However, the cmdlet is missing the ability to copy entire directories, which meant copying your files one by one or converting them to a compressed file in order to move big folders.

So I decided to create a small function Copy-VMFolder. The new cmdlet builds on Copy-VMFile allowing it to copy a complete folder from host to VM.

The function is available on GitHub at this link.

Feel free to use it and post your comments or suggestions.


About the author

Walid AlMoselhy

Permanent link to this article: http://almoselhy.azurewebsites.net/2017/07/powershell-function-copy-vmfolder/

Leave a Reply

Your email address will not be published. Required fields are marked *