I have a freshly installed Hyper-V server on Windows Server 2012R2 standard edition, and a VM inside with same OS version that hosts a domain and some file-based services. The host is NOT the member of the VM's domain, because there are no other servers in the local network, therefore no DCs to use if this one goes down. The host has a removable media attached that's intended to be a backup media. I need to back up files from the VM to that device.
I wonder if there's an ability to retrieve a file from the VM using Hyper-V tools, provided full compatibility on the host.
UPDATE: There is a commandlet Copy-VMFile
that suddenly has -FileSource
parameter available, but to my dismay this parameter can only accept the value of Host
, that is, copying the file is only provided TO the VM, not from it.
If they are on the same IP Subnet, you can still use UNC Paths to access shares, but you will need to authenticate with the correct domain credentials.
In your case, share the removable media on the host (remember to set share permissions as well as NTFS permissions), then from the guest, navigate to \\IPofHost\RemovableMedia.
You can maintain the link, with saved password from explorer (ScreenShot taken from Windows 10) :-
Another solution to backing up a HyperV VM is to use this :-
http://www.altaro.com/vm-backup/
It's free for 1 host and up to 2 Virtual Machines.
I've used it in the past, and it works very well. You can be as selective or not on what it backs up and when.
I'm not 100% sure on what you are trying to achieve but wouldn't Windows Server Backup give you everything you need? it will allow you to back up the VM or just the VHDX file from the VM if that's all you need. You can then restore the VHDX file (or the full VM) wherever you need it. Since you are using server 2012 R2 the newly restored VHDX can be mounted locally just by double clicking it then you can access all the files you want from it.
Alternatively if down time is not a problem then you could just shut down the VM, the VHDX can be mounted locally just by double clicking it then you can copy any files from it, after that dismount the VHDX in order to restart the VM.