Public/Copy-FileToVirtualMachine.ps1
|
<#
.SYNOPSIS Copies a file from the host to a virtual machine. .DESCRIPTION This function uses the Copy-VMFile cmdlet to copy a file from the host machine to a specified virtual machine. You need to call Register-VirtualMachineAliases before using this function to set the WDK VM name and credentials. #> function Copy-FileToVirtualMachine { [CmdletBinding()] param( [Parameter(Mandatory = $true, Position = 1)] [string] $SourcePath, [Parameter(Mandatory = $true, Position = 2)] [string] $DestinationPath, [Parameter(Mandatory = $True, Position = 0)] [string] $FileSource ) if (-not $script:VirtualMachineManager) { throw "Virtual Machine aliases are not registered. Run Register-VirtualMachineAliases first." } Copy-VMFile -CreateFullPath -VMName $script:VirtualMachineManager.VMName @PsBoundParameters } |