Copy a File From the Host to a VM Using a Powershell Script

Copying a file from the host into a VM is easy with Powershell and you can embed it into a script.
The syntax is:

Copy-VMFile "Test VM" -SourcePath "C:\FileOnHost.txt" -DestinationPath "D:\FolderInsideVM\file.txt" -CreateFullPath -FileSource Host

The above command will also create the target folder if it doesn’t exist.

You could use this command to push software installers into the VM, or update VM-interal scripts, for example.

 

Welcome to BackupChain, the Windows Server and Hyper-V Backup Solution for IT Professionals!

BackupChain is a full-featured Hyper-V backup solution and includes many features that make PowerShell scripting for backups unnecessary.

BackupChain Overview

Download BackupChain
How to Backup Hyper-V VMs
How to Backup to the Cloud
How to Backup VMware Workstation
How to Backup over FTP
How to Backup VirtualBox VMs
How to Backup Large Files and Folders

Popular

Resources


Backup Software Solution List
BackupChain
Veeam
Unitrends
Symantec Backup Exec
BackupAssist
Acronis
Zetta
Altaro
Windows Server Backup
Microsoft DPM
Ahsay
CommVault
IBM

Download BackupChain®