A security vulnerability has been discoverd in some VMware products (CVE-2017-5638).
It’s a critical vulnerability which allows remote code execution (RCE) on Apache Struts 2.
The vulnerability effects the following VMware products:
– DaaS 6.X / 7.X
– Hyperic 5.X
– vCenter 5.5 / 6.0 / 6.5
– vRops 6.X
I recently ran into the following problem: the situation occurs when you want to deploy a virtual machines with PowerCLI to a cluster with multiple datastores but your not licensed for Storage DRS.
The default PowerCLI behavior is to select the first datastore detected (alphabetic order). To solve this problem I created the following PowerCLI code:
$CLUSTER = "Production" # Cluster name
$FOLDER = "Deployed VMs" # Virtual Machine folder
### Select datastores available and sort them on free space (select the one with most space free)
$DS = Get-Cluster -Name $CLUSTER | Get-Datastore | Select Name, FreeSpaceGB | Sort-Object FreeSpaceGB -Descending | Select -first 1
### Create a virtual machine called VM01
New-VM -Name VM01 -ResourcePool $CLUSTER -Datastore $DS.Name -Location $FOLDER -MemoryGB 1 -CD -DiskGB 5
The code is tested with PowerCLI 6.5 R1 against a VMware vCenter 6.0 server.