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.

Backup Software Overview

Server Backup Software
Download BackupChain
Cloud Backup
Backup VMware Workstation
Backup FTP
Backup VirtualBox
Backup File Server

Hyper-V Backup

Backup Hyper-V
  • Step-by-Step Windows 10 Hyper-V Backups
  • 11 Things to Know About Hyper-V Snapshots / Checkpoints
  • How to Back up Hyper-V
  • Popular

    Resources


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

    Other Backup How-To Guides

    Download BackupChain®