Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232413

Re: svmotion script wait-task error

$
0
0

I've temporarily removed the $task = to try and get this working for 1 machine only, so this script is now this.

 

#Gets a list of Virtual Machines within the Folder that was identified before and assigns to a variable

$vms = get-vm -location "relocateme" | Select Name

 

 

Write-Host $vms

foreach ($vm in $vms) {

  Get-VM -Name $vm.Name | Move-VM -Datastore "Test Datastore" -Destination VMHOST1.NET -RunAsync

  }

 

I've renamed the machine and this is what I found:

 

AU-IT-SYD010 (Test Migration Machine)[TM][+]

(the original doesn't work)

 

AU-IT-SYD010

(works)

 

 

AU-IT-SYD010 (

(works)

 

AU-IT-SYD010 (Test Migration Machine)

(works)

 

 

AU-IT-SYD010 (Test Migration Machine)[

(fails!!!)

 

Get-VM : 9/05/2013 9:20:17 AM    Get-VM        The specified wildcard pattern is not valid: AU-IT-SYD010 (Test Migration Machine)[

At C:\temp\svmotion\svmotion7.ps1:14 char:8

 

So the problem is with the "[" symbol in the name of the machine.

 

Further more if I run the command with a "*" at the end it works.

 

Move-VM "AU-IT-SYD010 (Test Migration Machine)[TM][+]*" -Datastore "Test Datastore" -Destination VMHOST1.NET


Can I append a * to the end of each machine before the command is run?


Viewing all articles
Browse latest Browse all 232413

Trending Articles