Hello,
I am trying to Host vMotion a number of VMs (couple of hundred). I thought a CSV file would be the quickest way using PowerCLI. On paper this script looks complete and simple. However it wont work. Getting errors. I based this on deploying VMs from CSV file. Looking for some help.
Please review.
$movelist = "C:\Scripts\VM Move\vmmove.csv"
Import-Csv $movelist -UseCulture | %{
Get-VM -Name $._"Server" | Move-VM -Destination $._"Host" -Confirm:$false
}
The error message that I am getting, it thinks the name of the server is $._"Server". What did I miss? I want it to pull the name of the VM from the CSV file, do the same for the HOST name.
Error:
Get-VM : 7/11/2013 9:55:26 AM | Get-VM | VM with name '$._Server' was not found using the specified filter(s). |
At C:\Scripts\VM Move\Move_VM.ps1:24 char:1
+ Get-VM -Name $._"Server" | Move-VM -Destination $._"Host" -Confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo | : ObjectNotFound: (:) [Get-VM], VimException | |
+ FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM |
Thanks,
Boston Tech Guy
Answered my own question.. TYPO! I had $._ Not $_.
THANKS!