Export-SCTemplate

Applies To: System Center 2012 - Virtual Machine Manager

Export-SCTemplate

Exports a template from the VMM library to the specified path.

Syntax

Parameter Set: ServiceTemplate
Export-SCTemplate [-ServiceTemplate] <ServiceTemplate> -Path <String> [-AllowUnencryptedTransfer] [-IncludeAllLibraryResources] [-IncludeLibraryResources <ItemBase[]> ] [-Overwrite] [-Password <String> ] [-SettingsIncludePrivate] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: VMTemplate
Export-SCTemplate [-VMTemplate] <Template> -Path <String> [-AllowUnencryptedTransfer] [-IncludeAllLibraryResources] [-IncludeLibraryResources <ItemBase[]> ] [-Overwrite] [-Password <String> ] [-SettingsIncludePrivate] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

The Export-SCTemplate cmdlet exports a template from the System Center Virtual Machine Manager (VMM) library to the specified path. You can also export the library objects on which the template is dependent.

For more information about Export-SCTemplate, type: "Get-Help Export-SCTemplate -online".

Parameters

-AllowUnencryptedTransfer

Indicates that network file transfers do not require encryption. Allowing unencrypted network file transfers can improve performance if neither the source host nor the destination host requires encryption.

Use this parameter to:

- Allow unencrypted file transfers into, or out of, the library.

- Allow unencrypted file transfers into, out of, or within a host group.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IncludeAllLibraryResources

Indicates that all of the dependencies for a template are exported from the VMM library with the template.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IncludeLibraryResources<ItemBase[]>

Specifies dependent library resources that are to be exported with a template.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Overwrite

Indicates that an import or export operation will overwrite an existing file with the same name. Or, that an import operation will overwrite an existing virtual machine template or service template object with the same name.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Password<String>

Specifies a secure string that contains a password.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Path<String>

Specifies the destination path for the operation.

Example formats:

Local path -Path "F:\"

UNC path -Path "\\Library\Templates"

Volume GUID path -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"

VMware ESX path "Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"

Citrix XenServer path - Path "Local storage[99b6212f-b63d-c676-25f9-d6c460992de7]"

Wildcards are supported for "Get" cmdlets and when you specify the UNC path:

Example format:

UNC path -Path "\\VMHostServer\MyVMs\*VM*"

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ServiceTemplate<ServiceTemplate>

Specifies a service template object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SettingsIncludePrivate

Indicates that sensitive template settings are included in an import or export operation.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMTemplate<Template>

Specifies a VMM template object used to create virtual machines.

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.

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.

  • SCTemplate

Examples

1: Export a service template with all of its settings.

The first command gets the service template object named ServiceTemplate01 and stores the object in the $ServiceTemplate variable.

The second command exports the service template stored in $ServiceTemplate, including all settings, and overwrites existing template export packages that have the same name.

PS C:\> $ServiceTemplate = Get-SCServiceTemplate -Name "ServiceTemplate01"
PS C:\> Export-SCTemplate -ServiceTemplate $ServiceTemplate -Path "C:\TemplateExports" -SettingsIncludePrivate -Overwrite

2: Export multiple service templates with all of their settings.

This command uses the Get-SCServiceTemplate cmdlet to get all service template objects. Then, it uses the pipeline operator to send the objects to the to the Export-SCTemplate cmdlet which exports the templates, overwriting any existing files.

PS C:\> Get-SCServiceTemplate | Export-SCTemplate -Path "C:\TemplateExports" -SettingsIncludePrivate -Overwrite

3. Export a service template including its dependent library resources.

The first command gets the service template object named ServiceTemplate01 and stores the object in the $ServiceTemplate variable.

The second command exports ServiceTemplate01 and all of its dependent resources from the VMM library to C:\TempalteExports.

PS C:\> $ServiceTemplate = Get-SCServiceTemplate -Name "ServiceTemplate01"
PS C:\> Export-SCTemplate -ServiceTemplate $ServiceTemplate -Path "C:\TemplateExports" -IncludeAllLibraryResources

Import-SCTemplate