Remove a CIUser

This post was originally published on this site

Greetings everyone!

I already did a brief research on the matter, but failed to find a question, so if this question has already been answered I am sorry for the re-post.

 

My main problem is the following:

I am using PowerCLI version 5.1 release 2 to write scripts and manage my vCloud Director.

I have found a way to add Users into an Organization using the following script:

 

$role = Search-Cloud -QueryType Role -Name “Organization Administrator” | Get-CIView

$org = Get-Org -Name OrgName

$user = New-Object VMware.VimAutomation.Cloud.Views.User

$user.Name =”UserName”

$user.Password = “Password”

$user.Role = $role.href

$user.IsEnabled = $true 

$org.ExtensionData.createUser($user)

 

The user is created using the vCloud Director, inside the required organization.

 

However, I have not yet found a way how to remove a user from the vCloud using the PowerCLI environment.

 

If anyone has any idea on how to do that, please do tell!

 

Thanks a lot in advance!