I have one vCenter server with multiple clusters as described below...
yomama
jomama
Each cluster has a bunch of folders and they BOTH have the folder called 'Discovered virtual machine'.
I need to deploy my VM from a template but I need to target the specific cluster but when I try the below command.....
New-VM -Name doooofus -Template win2016x64 -Datastore superdoooperfast_ssd -Location "Discovered virtual machine" -ResourcePool yomama -DiskStorageFormat Thin
I get the below message....
"The specified parameter 'Location' expects a single value, but your name
criteria 'Discovered virtual machine' corresponds to multiple values."
But the VM deploys BUT it is in the root of the cluster.
How do I tell it explicitly what cluster to put my vm in and put it in the folder called 'Discovered virtual machine' in that specific cluster?
Thanks
Try like this
$clusterName = '<clustername>'
$folder = Get-CLuster -Name $clusterName | Get-Datacenter |
Get-Folder -Name 'Discovered virtual machine'
New-VM -Name doooofus -Template win2016x64 -Datastore superdoooperfast_ssd -Location $folder -ResourcePool yomama -DiskStorageFormat Thin
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The "Discovered virtual machine" folder is normally created under a datacenter, not a cluster.
Do you have those 2 clusters in 2 different datacenters?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
"Do you have those 2 clusters in 2 different datacenters?"
Yes. In different Geo Locations.
Try like this
$clusterName = '<clustername>'
$folder = Get-CLuster -Name $clusterName | Get-Datacenter |
Get-Folder -Name 'Discovered virtual machine'
New-VM -Name doooofus -Template win2016x64 -Datastore superdoooperfast_ssd -Location $folder -ResourcePool yomama -DiskStorageFormat Thin
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you sir! That did it.
I wanted it one liner so I made like this.....
New-VM -Name doooofus -Template 'win2016x64' -Datastore 'superdoooperfast_ssd' -Location (Get-Cluster -Name 'yomama' | Get-Datacenter | Get-Folder -Name 'Discovered virtual machine') -ResourcePool 'yomama' -DiskStorageFormat Thin
Works. Thanks again!