PowerCLI script to move virtual machines between datastores
Connect-VIServer vcenterserver
$input = Import-Csv C:\Temp\dslist.csv
foreach ($row in $input)
{
$FromDS=$row.FromDS
$ToDS=$row.ToDS
Get-Datastore $FromDS | Get-VM | Move-VM -DiskStorageFormat Thin -Datastore $ToDS –RunAsync
}
Disconnect-VIServer vcenterserver -Confirm:$false
<#
Content of dslist.csv
FromDS,ToDS
DS1,DS2
DS3,DS4
#>
No comments:
Post a Comment