I am trying to deploy a vm using a form.. the form works great...but when I try to make the vm deploy to a specific resource pool it fails with "spec.location.pool incorrect". If i remove the resource pool portion from the script, it deploys. Ideas?
sorry for the messy code, but I am troubleshooting this...
VMCreate = New-Object psobject
$VMCreate | Add-Member noteproperty VMName "testvm-vt02"
$VMCreate | Add-Member noteproperty Template "Template 20GB-Windows 2003 R2"
$VMCreate | Add-Member noteproperty Cluster "ACK2"
$VMCreate | Add-Member noteproperty Respool "Tier3"
$VMCreate | Add-Member noteproperty Datastore "T3-VF10KR5-51"
$VMCreate | Add-Member noteproperty Folder "LAB"
$VMCreate | Add-Member noteproperty OSType ""
$VMCreate | Add-Member noteproperty CPUs ""
$VMCreate | Add-Member noteproperty Memory ""
$VMCreate | Add-Member noteproperty Network "" #????
$VMCreate | Add-Member noteproperty Drives "" #This is an array of drive sizes in GB.
$VMCreate | Add-Member noteproperty Owners ""
$VMCreate | Add-Member noteproperty Dept ""
$VMCreate | Add-Member noteproperty Application ""
$VMCreate | Add-Member noteproperty MaintWindow ""
$VMCreate | Add-Member noteproperty Rank ""
$VMCreate | Add-Member noteproperty Notes ""
$Vmhost = "Esxackint-p02.osumc.edu"
#$Respool = Get-Cluster "ack2" | Get-ResourcePool "tier3"
#=======================
#Connect to VC Server- User will be prompted for password and username
$VCEncryptPassword = Read-Host "Please Enter your password" -AsSecureString
$VCPassCvrt=[http://System.Runtime.InteropServices.Marshal|http://system.runtime.interopservices.marshal/]::SecureStringToCoTaskMemUnicode($VCEncryptPassword)
#Change password back to regular text.
$Password = http://System.Runtime.InteropServices.Marshal::PtrToStringUni($VCPassCvrt)
$vcs = Connect-VIServer "VI-Server-01" -User "" -Password $Password
#$RespoolID = Get-Cluster $Vmcreate.Cluster | Get-ResourcePool $Vmcreate.Respool | select ID
#$RespoolID = Get-Cluster $Vmcreate.Cluster | Get-ResourcePool $Vmcreate.Respool
#get-template $Vmcreate.Template | New-VM -VMHost $VmCreate.Vmhost -Name $VMCreate.VMName -Datastore $Vmcreate.Datastore -ResourcePool $RespoolID -Location $VmCreate.folder
*
get-template $Vmcreate.Template | New-VM -VMHost $Vmhost -Name $VMCreate.VMName -Datastore $Vmcreate.Datastore
Any help would be great....*
*Glen
*
First you could check if the resource pool exists.
Does this return anything ?
Get-Cluster "ACK2" | Get-ResourcePool "Tier3"
The correct statement for getting the resource pool into a variable is
$RespoolID = Get-Cluster $Vmcreate.Cluster | Get-ResourcePool $Vmcreate.Respool
Can you perhaps attach the actual script that fails and the exact error messages you see ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
UPDATE: I figured it out. In my haste, I realized that I was actually doing it correctly but with a twist.
I was telling VC Deploy this template, to this host, blah blah..but what I failed to notice.. vmhost I was sending it to..did not exist in the cluster that held the resource pool I was trying to send the VM to...if that makes sense. I changed the Vmhost..and it worked like a charm...
Thanks for your help.. It was nice to know I was doing right..but not so nice that it was something so silly, and so self inflicted...
I did that.. darn..
Error in PowerGui:
1/26/2009 2:45:20 PM New-VM 89CB40E2-CA51-4AA4-B168-8FA94D82BC87 The
operation for the entity vm-2733 failed with the following message: "A
specified parameter was not correct.
spec.location.pool"
At :line:39 char:40
+ get-template $Vmcreate.Template | New-VM <<<< -Vmhost $Vmhost -Name
$VMCreate.VMName -ResourcePool $Respool2 -Datastore $Vmcreate.Datastore
-Location $Vmcreate.Folder
Error in VC Recent Tasks:
A Specified parameter was not correct. Spec.Location.Pool
thanks..
Glen
Glen E. Adkins II
VMware Enterprise Admin
Server Support/Engineering
Phone:(614)-293-0731
Pager:(614)-346-4195
Glen.AdkinsII@osumc.edu