Friday, October 10, 2025
HomePowershellCopy File to a number of (all) Hyper-V VMs – SID-500.COM

Copy File to a number of (all) Hyper-V VMs – SID-500.COM


PowerShell

On this submit, I’ll present you how you can copy a number of recordsdata to all VMs in Hyper-V. I’d say: Let’s get began.

Stipulations

To repeat recordsdata, visitor companies have to be enabled on all VMs. The visitor companies are a part of the combination companies. By default, they’re not enabled!

To allow Visitor Providers on all Hyper-V VMs run the code beneath.

Get-VM | Allow-VMIntegrationService -Title 'Visitor Service Interface'

Then the verification.

Get-VM | Get-VMIntegrationService

Motion: Copy one file to all VMs

Now we’re prepared to repeat a file to all VMs. The file can be copied from the person residence folder to the person residence folder on the VM. Let’s go.

New-Merchandise $residence -ItemType File -Title datei1.txt -Worth 'Hi there World' -Pressure

$vm = (Get-VM).Title
foreach ($v in $vm) {
    Copy-VMFile $v -SourcePath $homedatei1.txt -DestinationPath $homedatei1.txt -CreateFullPath -FileSource Host -Verbose
}

Mission completed.

Printed by Patrick Gruenauer

Microsoft MVP on PowerShell [2018-2023], IT-Coach, IT-Advisor, MCSE: Cloud Platform and Infrastructure, Cisco Licensed Academy Teacher.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments