# Script for Vm Datastore Migration
# Author.: Michele Pavan
# Date...: 23/01/2013
# License: Version 2 of
the GPL. Do not change the author. You must specify the original author.
$hostVCenter = "myVcenter"
$datastore = "Iomega"
$vm = "Srv1"
add-pssnapin VMware.VimAutomation.Core
#Connection to Vcenter
Connect-VIServer $hostVCenter
#changing mail details
#Get Date and time start
$date = Get-Date -Format "dd/MM/yyyy"
$time = (Get-Date -f "HH:mm")
$subject = "VM migration ",$vm
$body = "VM Migration start: ",$vm," - ",$date," ",$time
C:\Scripts\powercli\sendmail.ps1
#Migration
Move-Vm -Datastore $dataStore -VM $vm
#changing mail details
#Get Date and time end
$date = Get-Date -Format "dd/MM/yyyy"
$time = (Get-Date -f "HH:mm")$body = "VM Migration end: ",$vm," - ",$date," ",$time
C:\Scripts\powercli\sendmail.ps1
-------------------------------------
If you will use this code please, leave a message.
Nessun commento:
Posta un commento