VIPermission Category | Vmware PowerCLI Reference

VI Permission 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-VIPermission cmdlet. See example below:

# Retrieves the permissions of the Administrator user on the provided datacenters.

Get-VIPermission -Entity (Get-Datacenter) -Principal Administrator

Step 2 : Run commands from the CRUD group

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

# Creates a permission on the provided server for a role with the specified privileges.

New-VIRole -Name Role -Server $server -Privilege (Get-VIPrivilege -PrivilegeGroup) $permission = New-VIPermission -Role Role -Principal Administrator -Entity (Get-Datacenter)
You can UPDATE objects by using Set-VIPermission cmdlet. See example below:

# Changes the Propagate property of the $permission permission to $false.

Set-VIPermission -Permission $permission -Role Role -Propagate:$false
You can REMOVE objects by using Remove-VIPermission cmdlet. See example below:

# Removes the $permission permission without asking for confirmation.

Remove-VIPermission -Permission $permission -Confirm:$false