Esportare un pacchetto da un Server VMM e importarla sullo stesso server VMM (Script)

 

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

È possibile esportare un modello di servizio da un VMM server di gestione in un'altra posizione. Ad esempio, in uno scenario di backup, è possibile esportare il modello di servizio in una condivisione di e quindi "Ripristina" modello importandolo allo stesso VMM server di gestione. Importazione di un modello di servizio sullo stesso VMM server di gestione da cui è stato importato è piuttosto semplice e non è necessario alcun mapping.

Per informazioni su come importare un modello a un altro, ma in modo analogo, VMM server di gestione, vedere esportare un pacchetto da un Server VMM e importare in un Server VMM simile (Script). Per informazioni su come importare un modello in un diverso VMM server di gestione, vedere esportare un pacchetto da un Server VMM e importare 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 per lo stesso VMM server di gestione.

  
# 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