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 = 0)] [string] $SourcePath, [Parameter(Mandatory = $false, Position = 1)] [string] $DestinationPath ) if (-not $script:VirtualMachineManager) { throw "Virtual Machine aliases are not registered. Run Register-VirtualMachineAliases first." } Copy-VMFile -ComputerName WdkGuestMachine -CreateFullPath -VMName $WdkVmName -Credential $WdkCredential -FileSource Host @PSBoundParameters } |