Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Import-SCTemplate

Updated: November 1, 2013

Applies To: System Center 2012 R2 Virtual Machine Manager

Import-SCTemplate

Imports a virtual machine template or service template into the VMM library.

Syntax

Parameter Set: Package
Import-SCTemplate -TemplatePackage <Package> [-AllowUnencryptedTransfer] [-Name <String> ] [-Overwrite] [-PackageMapping <PackageMapping[]> ] [-Password <String> ] [-Release <String> ] [-SettingsIncludePrivate] [-SharePath <String> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: Path
Import-SCTemplate -Path <String> [-AllowUnencryptedTransfer] [-Name <String> ] [-Overwrite] [-PackageMapping <PackageMapping[]> ] [-Password <String> ] [-Release <String> ] [-SettingsIncludePrivate] [-SharePath <String> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]




Detailed Description

The Import-SCTemplate cmdlet imports a virtual machine template or service template into the VMM library. To export a template out of the library, see Export-SCTemplate.

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

-Name<String>

Specifies the name of a VMM object.


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

-PackageMapping<PackageMapping[]>

Specifies a package mapping object.


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

-Release<String>

Specifies a string that describes the release of a library resource. VMM automatically creates a release value for every resource imported into the library. After the resource has been imported, the string can be customized.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

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

-SharePath<String>

Specifies a path to a valid library share on an existing library server that uses a Universal Naming Convention (UNC) path.

Example format: –SharePath "\\LibServer01\LibShare"


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-TemplatePackage<Package>

Specifies an exported template package that contains seralized settings of a service or virtual machine template.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

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

<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: Import a previously exported template package.

The first command gets the exported template package object at the specified path and stores the object in the $Package variable.

The second command imports the template package object stored in $Package, including all template settings.


PS C:\> $Package = Get-SCTemplatePackage -Path "C:\TemplateExports\ServiceTemplate01.new.xml"PS C:\> Import-SCTemplate -TemplatePackage $Package -SettingsIncludePrivate

2: Import an export package and specify a new name and release for the imported template.

This command imports the specified template export package with all of the template's settings and specifies a new name and release for the imported template.


PS C:\> Import-SCTemplate -Path "C:\TemplateExports\ServiceTemplate01.new.xml" -SettingsIncludePrivate -Name "New Service Name" -Release "1.0"

3. Importing a template that has some/all resources in the exported package while changing mapping

The first command creates a package mapping object for the package stored at the specified path and then stores the package mapping object in the $Mappings variable.

The second command gets a mapping object by package ID and stores the object in the $Mapping variable.

The third command gets the virtual hard disk object named VHD01 and stores the object in the $Resource variable.

The fourth command binds the mapping stored in $Mapping to the object stored in $Resource (VHD01).

The fifth command sets the package file for the mapping stored in $Mapping.

The last command imports the template at the specified path with the specified mappings (in this case, VHD01 imports to Share01).


PS C:\> $Mappings = New-SCPackageMapping -Path "C:\TemplateExports\VMTemplate01.xml" -PreferPackageResourcesPS C:\> $Mapping = $Mappings | where {$_.PackageID -eq "VHD01.vhd"}PS C:\> $Resource = Get-SCVirtualHardDisk -Name "VHD01.vhd"PS C:\> Set-SCPackageMapping -PackageMapping $Mapping -TargetObject $ResourcePS C:\> Set-SCPackageMapping -PackageMapping $Mapping -PackageFile "C:\TemplateExports\Resources\VHD01.vhd"PS C:\> Import-SCTemplate -Path C:\TemplateExports\VMTemplate01.xml -PackageMapping $Mapping -SharePath "\\LibServer01\Share01"

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.