I hacked together a script using just machines
#https://communities.vmware.com/message/1666605#1666605
#http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.cluster.VmGroup.html
#https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.cluster.GroupSpec.html
# Loading PowerCLI Snapins
function LoadSnapin{
param($PSSnapinName)
if (!(Get-PSSnapin | where {$_.Name -eq $PSSnapinName})){
Add-pssnapin -name $PSSnapinName
}
}
LoadSnapin -PSSnapinName "VMware.VimAutomation.Core"
#Function for updating the Resource VM Groups
function updateDrsVmGroup ($clusterName,$VMFilter,$groupVMName)
{
#Get Cluster Information
$cluster = Get-Cluster -Name $clusterName
$spec = New-Object VMware.Vim.ClusterConfigSpecEx
$groupVM = New-Object VMware.Vim.ClusterGroupSpec
$groupVM.operation = "edit"
$groupVM.Info = New-Object VMware.Vim.ClusterVmGroup
$groupVM.Info.Name = $groupVMName
#Perform your VM selection here.
Get-VM -Name $VMFilter | % {$groupVM.Info.VM += $_.Extensiondata.MoRef}
$spec.GroupSpec += $groupVM
#Apply the settings to the cluster
$cluster.ExtensionData.ReconfigureComputeResource($spec,$true)
}
$CredentialID="domain\user"
$vCenterServer="vCenter1"
$cred = Get-Credential $CredentialID
Connect-VIServer -server $vCenterServer -credential $cred
# Calling the function. I've found the group names to be case sensitive, so watch for that.
updateDrsVmGroup -clusterName "Lab1" -VMFilter "ABC*" -groupVMName "MACHINE-GROUP"
Disconnect-VIServer -Confirm:$False