#Nombre del Servidor hyper-v
$HyperVHostOrigen="hyperv-01"
#Carpeta donde reside el Export Anterior
$dirMaquina = "D:BackupBackup_2009_7_62008"
$dirMaquina = "D:BackupBackup_2009_7_62008"
#Instanciamos el Servicio de VMM
$VM_Service = get-wmiobject -computer $HyperVHostOrigen -namespace rootvirtualization -class Msvm_VirtualSystemManagementService
$VM_Service = get-wmiobject -computer $HyperVHostOrigen -namespace rootvirtualization -class Msvm_VirtualSystemManagementService
#Importamos la maquina
$Status = $VM_Service.ImportVirtualSystem("$dirmaquina", $True)
If ($status.ReturnValue -eq 4096)
{
$Job = [WMI]$Status.Job
$JobStatus = $Job.JobState
while ($JobStatus -ne 7)
{
sleep(1)
$Job = [WMI]$Status.Job
$JobStatus = $Job.JobState
echo $job.PercentComplete
}
}
$Status = $VM_Service.ImportVirtualSystem("$dirmaquina", $True)
If ($status.ReturnValue -eq 4096)
{
$Job = [WMI]$Status.Job
$JobStatus = $Job.JobState
while ($JobStatus -ne 7)
{
sleep(1)
$Job = [WMI]$Status.Job
$JobStatus = $Job.JobState
echo $job.PercentComplete
}
}