Copy-VMFile
Copy-VMFile
Copies a file to a virtual machine.
Sintaxis
Parameter Set: Name
Copy-VMFile [-Name] <String[]> [-SourcePath] <String> [-DestinationPath] <String> -FileSource <CopyFileSourceType> [-AsJob] [-ComputerName <String[]> ] [-CreateFullPath] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMObject
Copy-VMFile [-VM] <VirtualMachine[]> [-SourcePath] <String> [-DestinationPath] <String> -FileSource <CopyFileSourceType> [-AsJob] [-CreateFullPath] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Descripción detallada
The Copy-VMFile cmdlet copies a file to a virtual machine.
Parámetros
-AsJob
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-ComputerName<String[]>
Specifies an array of Hyper-V hosts. The cmdlet copies the file to the hosts you specify.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
. |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-CreateFullPath
Indicates that when the cmdlet copies a file, it creates folders if the folder does not already exist.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-DestinationPath<String>
Specifies a path. The cmdlet copies the file to the destination path.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
3 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-FileSource<CopyFileSourceType>
Specifies the type of a file source.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Force
Fuerza que el comando se ejecute sin pedir confirmación al usuario.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Name<String[]>
Specifies an array of virtual machine objects by name. The cmdlet copies files to the virtual machines you specify.
Alias |
VMName |
¿Requerido? |
true |
¿Posición? |
1 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-SourcePath<String>
Specifies a path. The cmdlet copies the file from the source path.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
2 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByValue) |
¿Aceptar caracteres comodín? |
false |
-VM<VirtualMachine[]>
Specifies an array of virtual machine objects. The cmdlet copies files to the virtual machines you specify. To obtain a virtual machine object, use the Get-VM cmdlet.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
1 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByValue) |
¿Aceptar caracteres comodín? |
false |
-Confirm
Solicita confirmación antes de ejecutar el cmdlet.
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
falso |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-WhatIf
Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
falso |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
<CommonParameters>
Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Entradas
El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.
Salidas
El tipo de resultado es el tipo de objetos que emite el cmdlet.
Ejemplos
Example 1
This example copies the file “test.txt” from the host operating system into the guest operating system of the virtual machine “Test VM”. It will create the directory “C:\Temp” inside the guest operating system if it does not exist already.
PS C:\> Copy-VMFile "Test VM" -SourcePath "D:\Test.txt" -DestinationPath "C:\Temp\Test.txt" -CreateFullPath -FileSource Host