Hello,
I have a PowerCLI script that specifies a host and datastore to create a new virtual machine on, which has served us well. Now we have enabled DRS and Storage DRS and I am wondering what needs to change in order to take advantage of these features. Are there commands to specify a cluster and datastore cluster and let DRS decide initial placement for a new VM? Right now we set all of the hosts and datastores as variables and use them in the line below.
Thanks.
$newVM = New-VM -Name $NewVMname -VM $TemplateName -Datastore $datastore -VMHost $vHost -Confirm:$false -Location $myName
Did you define a Datastorecluster ?
If yes, then you can replace the Datastore parameter value with the datastorecluster object.
Replacing a VMHost with a cluster is not supported I'm afraid.
But you can use something like this
New-VM -Name TestVM -Datastore DSC -ResourcePool (Get-Cluster -Name MyCluster | Get-Resourcepool -Name Resources)
This will automatically select the VMHost.
The VM will appear in the root of the cluster.
DSC is the name of a datastorecluster in cluster MyCluster
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you define a Datastorecluster ?
If yes, then you can replace the Datastore parameter value with the datastorecluster object.
Replacing a VMHost with a cluster is not supported I'm afraid.
But you can use something like this
New-VM -Name TestVM -Datastore DSC -ResourcePool (Get-Cluster -Name MyCluster | Get-Resourcepool -Name Resources)
This will automatically select the VMHost.
The VM will appear in the root of the cluster.
DSC is the name of a datastorecluster in cluster MyCluster
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc,
So yes we actually have a datastore cluster. Thinking about it some more I suppose specifying the host isn't really an issue, since DRS will decide initial placement at power up anyway.
BTW I loved your blog post about scripting DVS configurations. That is great stuff.