Datacenter Category | Vmware PowerCLI Reference

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

# Retrieves a list of all datacenters on the server, whose names begin with "Datacenter".

Get-Datacenter -Name Datacenter*

Step 2 : Run commands from the CRUD group

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

# Gets the inventory root folder and create a new folder called Folder in it. Creates a new datacenter called Datacenter in the Folder folder. The result is pipelined to the fl command to retrieve a flat view of the new datacenter properties.

$folder = Get-Folder -NoRecursion | New-Folder -Name Folder New-Datacenter -Location $folder -Name Datacenter | fl
You can UPDATE objects by using Move-Datacenter cmdlet. See example below:

# Moves the Datacenter datacenter into the folder named Folder.

Move-Datacenter Datacenter -Destination Folder
You can REMOVE objects by using Remove-Datacenter cmdlet. See example below:

# Removes the Datacenter datacenter.

Remove-Datacenter Datacenter

Step 3: Explore More Related Commands:

Set-Datacenter This cmdlet modifies the properties of the specified datacenter.