Drs Category | Vmware PowerCLI Reference

Drs Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations

Step 1: Retrieve a object by running a Get command

You can READ objects by using Get-DrsClusterGroup cmdlet. See example below:

# Retrieves the corresponding DRS cluster groups associated with any of the virtual machines from the specified list.

Get-DrsClusterGroup -VM $vm1, $vm2

Step 2 : Run commands from the CRUD group

You can CREATE objects by using New-DrsClusterGroup cmdlet. See example below:

# Creates a VM DRS cluster group in the "MyCluster" cluster by adding a list of virtual machines inside.

New-DrsClusterGroup -Name "MyDrsClusterGroup" -VM "MyVM1", "MyVM2" -Cluster "MyCluster"
You can UPDATE objects by using Invoke-DrsRecommendation cmdlet. See example below:

# Retrieves and applies DRS recommendations with priorities 1 and 2.

Get-DrsRecommendation -Priority 1,2 | Invoke-DrsRecommendation
You can REMOVE objects by using Remove-DrsClusterGroup cmdlet. See example below:

# Removes the "MyClusterGroup" DRS cluster group from the environment.

Remove-DrsClusterGroup -DrsClusterGroup "MyClusterGroup"

Step 3: Explore More Related Commands:

Get-DrsRecommendation This cmdlet retrieves the available DRS recommendations from the provided clusters.
Get-DrsRule This cmdlet retrieves the list of DRS rules for the specified clusters.
Get-DrsVMHostRule This cmdlet retrieves VM to VMHost DRS rules that match the specified filters.
New-DrsRule This cmdlet creates a new DRS rule.
New-DrsVMHostRule This cmdlet creates a new VM to VMHost DRS rule.
Remove-DrsRule This cmdlet removes the specified DRS rules.
Remove-DrsVMHostRule This cmdlet removes the specified VM to VMHost DRS rule.
Set-DrsClusterGroup This cmdlet adds or removes either virtual machines or VM hosts to or from the specified DRS cluster group, depending on the used parameter set.
Set-DrsRule This cmdlet modifies an existing DRS rule.
Set-DrsVMHostRule This cmdlet modifies the specified VM to VMHost DRS rule.