다음을 통해 공유


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

 

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

서비스 템플릿을 내보낼 수는 VMM 다른 위치에 관리 서버입니다. 예를 들어 백업 시나리오에서는 공유에 서비스 템플릿을 내보낼 하 고 다음 "복원할 수" 템플릿을 동일 하 게 가져와서 VMM 관리 서버입니다. 같은 서비스 템플릿을 가져오는 VMM 관리 서버를 가져온 것은 매우 간단 하 고 필요는 매핑이 없습니다.

마찬가지로 하지만 다른, 서식 파일을 가져오는 방법에 대 한 내용은 VMM 관리 서버 참조 비슷한 VMM 서버 (스크립트)에 VMM 서버를 가져올에서 패키지를 내보낼합니다. 에 서로 다른 템플릿을 가져오는 방법에 대 한 내용은 VMM 관리 서버 참조 고급 (스크립트) 매핑을 사용 하 여 서로 다른 VMM 서버에는 VMM 서버를 가져올에서 패키지를 내보낼합니다.

참고

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

고 지 사항

다음 스크립트는 로드 하 고 지정 된 서비스 템플릿을 내보낼 내보내기 ServiceTemplate.ps1 라는 함수를 사용 합니다. 동일 하 게 지정 된 서식 파일을 다음 가져옵니다 VMM 관리 서버입니다.

  
# Description:   This script uses a function to export a service template, then   
#                restores the specified service to the same 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 path."),  
  
   [parameter(Mandatory=$true)]  
   [String] $VMMServer=$(throw "Please provide the name of a VMM server.")  
   )  
  
# Import the export function into the Windows PowerShell session.  
. .\Export-ServiceTemplate.ps1  
  
# Export the service template.  
Export-ServiceTemplate -Name $ServiceTemplate -Release $Release -Path $Path -VMMServer $VMMServer  
  
# Get the template package and the service template.  
$RestorePath = "$Path\$ServiceTemplate.$Release.xml"  
$Package = Get-SCTemplatePackage -Path $RestorePath  
Import-SCTemplate -TemplatePackage $Package -SettingsIncludePrivate -Overwrite