次の方法で共有


Export-VM

Export-VM

Exports a virtual machine to disk.

Syntax

Parameter Set: Name
Export-VM [-Name] <String[]> [-Path] <String> [-AsJob] [-ComputerName <String[]> ] [-Passthru] [ <CommonParameters>]

Parameter Set: VMObject
Export-VM [-VM] <VirtualMachine[]> [-Path] <String> [-AsJob] [-Passthru] [ <CommonParameters>]

Detailed Description

The Export-VM cmdlet exports a virtual machine to disk. This cmdlet creates a folder at a specified location having three subfolders: Snapshots, Virtual Hard Disks, and Virtual Machines. The Snapshots and Virtual Hard Disks folders contain the snapshots of and virtual hard disks of the specified virtual machine respectively. The Virtual Machines folder contains the configuration XML of the specified virtual machine.

Parameters

-AsJob

Specifies that the cmdlet is to be run as a background job.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the virtual machine is to be exported. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.

Aliases

none

Required?

false

Position?

named

Default Value

.

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String[]>

Specifies the name of the virtual machine to be exported.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Passthru

Specifies that a Microsoft.Virtualization.Powershell.VirtualMachine object is to be passed through to the pipeline representing the virtual machine to be exported.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Path<String>

Specifies the path to the folder into which the virtual machine is to be exported.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

true

-VM<VirtualMachine[]>

Specifies the virtual machine to be exported.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None by default; Microsoft.Virtualization.Powershell.VirtualMachine if –PassThru is specified.

Examples

Example 1

Exports virtual machine Test to the root of the D drive.

PS C:\> Export-VM –Name Test –Path D:\

Example 2

Exports all virtual machines to the root of the D drive. Each virtual machine will be exported to its own folder.

PS C:\> Get-VM | Export-VM –Path D:\