Esportare un pacchetto da un Server VMM e importate in un simile Server VMM (Script)

 

Si applica a: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

È possibile condividere modelli di servizio tra VMM server di gestione esportando il modello da una VMM management server e quindi importarlo in un altro. Se il VMM server di gestione sono configurati in modo analogo, questo processo è piuttosto semplice e non è necessario alcun mapping. Se il VMM server di gestione sono configurati in modo diverso, è necessario implementare il mapping di pacchetto. Per ulteriori informazioni sull'importazione di un pacchetto tramite mapping, vedere esportare un pacchetto da un Server VMM e importazione in un Server VMM dissimili mappando utilizzando Advanced (Script).

Nota

Lo script in questo argomento si presuppone di aver salvato la funzione creare una funzione che consente di esportare un pacchetto (Script) con il nome ServiceTemplate.ps1 esportazione.

Dichiarazione di non responsabilità

Lo script seguente carica e utilizza la funzione denominata ServiceTemplate.ps1 di esportazione per esportare il modello di servizio specificato. Quindi Importa il modello specificato da un VMM server di gestione che è simile a quello da cui è stato esportato il modello.

  
<#  
  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