VMware Cloud Community
malabelle
Enthusiast
Enthusiast
Jump to solution

Move-VM problem

Hi,

trying to move vm to new datastore... I always get error saying


Move-VM : 3/10/2011 9:04:36 AM    Move-VM        The specified parameter 'Datastore' expects a single value, but your name criteria 'VOL_CLIENT_B' corresponds to multiple values.

or

Move-VM : Cannot convert 'System.Object[]' to the type 'VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.Datastore' required by parameter 'Datastore'. Specified method is not supported.

Here is my script.

$vcenter = "eagateway.ealab.psp"
$sequence = Import-Csv "Migration.csv"
Connect-VIserver $vcenter | Out-Null

$sequence | % {
$Name = $_.Name
$OldLUN = $_.OldLUN
$NewLUN = $_.NewLUN
$ProvisionedGB = $_.ProvisionedGB
$SizeGB = $_.SizeGB
$Format = $_.Format
$Snapshot = $_.Snapshot
$SnapshotGB = $_.SnapshotGB
$Batch = $_.Batch

Get-VM -Name $Name | Where {$Batch -eq "A003"}| Move-VM -datastore (Get-datastore $NewLUN)

}

I tried to run manually:

Move-VM -VM "SEQDEV6" -Datastore "Test_Sequence_Dev" -confirm:$false

vExpert '16, VCAP-DCA, VCAP-DCD
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The maximum number of parallel vMotions you can do is 2.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Or you have multiple datastores with that name or you have multiple connects.

Check if this

Get-Datastore "Test_Sequence_Dev"

returns more than 1 object.

Or display the contents of

$defaultVIServers

and check if there is more than 1 connection.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

malabelle
Enthusiast
Enthusiast
Jump to solution

you're right.

I'll add a Disconnect at the end of the script and start it without connecting first...

[vSphere PowerCLI] C:\Users\malabelle\Desktop\tests\Migration> Get-Datastore "Test_Sequence_Dev"

Name                               FreeSpaceMB      CapacityMB
----                               -----------      ----------
TEST_Sequence_Dev                       209659          240384
TEST_Sequence_Dev                       209659          240384


[vSphere PowerCLI] C:\Users\malabelle\Desktop\tests\Migration> echo $defaultVIServers

Name                           Port  User
----                           ----  ----
eagateway.ealab.psp            443   EALAB\malabelle
localhost                      443   EALAB\malabelle

vExpert '16, VCAP-DCA, VCAP-DCD
0 Kudos
malabelle
Enthusiast
Enthusiast
Jump to solution

Perfect it works.

I run it Async, it does 2 at a time, do you know if it is possible to force it to do 4-6 at a time?

vExpert '16, VCAP-DCA, VCAP-DCD
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The maximum number of parallel vMotions you can do is 2.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
malabelle
Enthusiast
Enthusiast
Jump to solution

Ok thanks.

vExpert '16, VCAP-DCA, VCAP-DCD
0 Kudos