다음을 통해 공유


VMM 서버에서 패키지를 내보내고 가져옵니다 비슷한 VMM 서버 (스크립트)

 

적용 대상: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

간에 서비스 템플릿을 공유할 수 VMM 관리 서버 하나에서 서식 파일을 내보내 VMM 관리 서버와 다른 가져오면 됩니다. 하는 경우는 VMM 관리 서버는 비슷하게 구성 되지만,이 과정은 매우 간단 되며 없습니다 매핑이 필요 합니다. 경우에 VMM 관리 서버가 서로 다른 방식으로 구성, 패키지 매핑을 구현 해야 합니다. 매핑을 사용 하 여 패키지 가져오기에 대 한 자세한 내용은 참조 를 사용 하 여 고급 매핑 (스크립트) 하 여 서로 다른 VMM 서버에 VMM 서버와 가져오기 것에서 패키지를 내보낼합니다.

참고

이 항목의 스크립트에서 함수를 저장 하는 것으로 가정 함수 내보냅니다 (스크립트) 패키지를 만드는 내보내기 ServiceTemplate.ps1 이름입니다.

고 지 사항

다음 스크립트는 로드 하 고 지정 된 서비스 템플릿을 내보낼 내보내기 ServiceTemplate.ps1 라는 함수를 사용 합니다. 지정 된 서식 파일을 가져온 다음는 VMM 은 서식 파일을 내보낸 것과 비슷한 관리 서버에 있습니다.

  
<#  
  Description:   This script calls a function to export a service template, then  
                 restores the specified template to a similar but different VMM  
                 management server.  
#>  
  
Param (  
   [parameter(Mandatory=$true)]  
   [String] $ServiceTemplate=$(throw "Please provide the name of a service template."),  
  
   [parameter(Mandatory=$true)]  
   [String] $Release=$(throw "Please provide a release for the service template."),  
  
   [parameter(Mandatory=$true)]  
   [String] $Path=$(throw "Please provide a share path."),  
  
   [parameter(Mandatory=$true)]  
   [String] $VMMServer=$(throw "Please provide the name of a VMM server.")  
   )  
  
# Import the file containing the export function into the Windows PowerShell session.  
. .\Export-ServiceTemplate.ps1  
  
# Export the service template using the Export-ServiceTemplate function.  
Export-ServiceTemplate -Name $ServiceTemplate -Release $Release -Path $Path -VMMServer $VMMServer  
  
# Get the template package.  
$RestorePath = "$Path\$ServiceTemplate.$Release.xml"  
$Package = Get-SCTemplatePackage -Path $RestorePath  
  
# Import the package to a similar VMM management server.  
Import-SCTemplate -VMMServer "VMMServer02.Contoso.com" -TemplatePackage $Package -SettingsIncludePrivate -Overwrite