VMware Cloud Community
TomasSnajdar
Contributor
Contributor

How to create Custom Role and set Description via PowerCLI commands

Hello,

as Subject says, I am trying to create new Role for multiple VCSAs via using PowerCLI console.

Right now I have created new Custom Role in one VCSA from where I download Role Privileges via command:

(Get-VIRole -name “Role Name”).ExtensionData.Privilege

and save output to .txt file

Then via sets of commands:

$Role = New-VIRole -Name "NewRole"
$privilege = Get-content C:\Temp\roles.txt
$privilege | foreach {Set-VIRole -role $role -AddPrivilege (get-viprivilege -id $_) }

to create new Role on connected VCSAs. These command create only raw Role with Privileges, but without any Description, which I want to set. I was also trying to edit Description after creating of new Role, but without success. I also checked PowerCLI documentation https://developer.vmware.com/docs/powercli/latest/products/vmwarevsphereandvsan/categories/virole/ , where is mentioned parameter 'Description', but I am not able to figured out how to use it:

(Get-VIRole -name “NewRole”) | Select Description, Name

Can somebody able to help me with it to create new Role with all required information (Description, Usage, Privileges).

Thank you.

0 Kudos
0 Replies