Task Category | Vmware PowerCLI Reference

Task 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-Task cmdlet. See example below:

# Retrieves information on all tasks on the server with IP address 10.23.112.235, whose state is "Error". This example uses commands from the VMware.VimAutomation.Core module.

Import-Module VMware.VimAutomation.Core $server = Connect-VIServer -Server 10.23.112.235 $task = Get-Task -Server $server -Status Error $task

Step 2 : Run commands from the CRUD group

You can UPDATE objects by using Stop-Task cmdlet. See example below:

# Stops the process of creating a new template from a virtual machine. This example uses commands from the VMware.VimAutomation.Core module.

Import-Module VMware.VimAutomation.Core $vm = Get-VM -Name "VM1" $datacenter = Get-Datacenter -Name "Datacenter1" $task = New-Template -Name "Template1" -Location $datacenter -VM $vm -RunAsync Stop-Task -Task $task

Step 3: Explore More Related Commands:


Wait-Task This cmdlet waits for the completion of the specified tasks.