Export-SCTemplate

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

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

ServiceTemplate

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a service template object.

Path

Required? true
Accept Pipeline Input? false
Position? named
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*"

AllowUnencryptedTransfer

Required? false
Accept Pipeline Input? false
Position? named
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.

IncludeAllLibraryResources

Required? false
Accept Pipeline Input? false
Position? named
Indicates that all of the dependencies for a template are exported from the VMM library with the template.

IncludeLibraryResources

Required? false
Accept Pipeline Input? false
Position? named
Specifies dependent library resources that are to be exported with a template.

Overwrite

Required? false
Accept Pipeline Input? false
Position? named
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.

Password

Required? false
Accept Pipeline Input? false
Position? named
Specifies a secure string that contains a password.

SettingsIncludePrivate

Required? false
Accept Pipeline Input? false
Position? named
Indicates that sensitive template settings are included in an import or export operation.

VMMServer

Required? false
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a VMM server object.

VMTemplate

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a VMM template object used to create virtual machines.

Path

Required? true
Accept Pipeline Input? false
Position? named
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*"

AllowUnencryptedTransfer

Required? false
Accept Pipeline Input? false
Position? named
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.

IncludeAllLibraryResources

Required? false
Accept Pipeline Input? false
Position? named
Indicates that all of the dependencies for a template are exported from the VMM library with the template.

IncludeLibraryResources

Required? false
Accept Pipeline Input? false
Position? named
Specifies dependent library resources that are to be exported with a template.

Overwrite

Required? false
Accept Pipeline Input? false
Position? named
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.

Password

Required? false
Accept Pipeline Input? false
Position? named
Specifies a secure string that contains a password.

SettingsIncludePrivate

Required? false
Accept Pipeline Input? false
Position? named
Indicates that sensitive template settings are included in an import or export operation.

VMMServer

Required? false
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a VMM server object.

Examples

1: Export a service template with all of its settings.
PS C:\> $ServiceTemplate = Get-SCServiceTemplate -Name "ServiceTemplate01"
PS C:\> Export-SCTemplate -ServiceTemplate $ServiceTemplate -Path "C:\TemplateExports" -SettingsIncludePrivate -Overwrite
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.
2: Export multiple service templates with all of their settings.
PS C:\> Get-SCServiceTemplate | Export-SCTemplate -Path "C:\TemplateExports" -SettingsIncludePrivate -Overwrite
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.
3. Export a service template including its dependent library resources.
PS C:\> $ServiceTemplate = Get-SCServiceTemplate -Name "ServiceTemplate01"
PS C:\> Export-SCTemplate -ServiceTemplate $ServiceTemplate -Path "C:\TemplateExports" -IncludeAllLibraryResources
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.

See Also