Adding roles with privileges from powercli

This will be very quick and short one 😉
We can easily create a role within our VC using the new-virole cmdlet. Since it accepts the privilege IDs as an array we can first fill up our array with privileges and then give it to new-virole.
In order to see from which we can run get-viprivilege to get all of them first. If you already know which one to include :

New-VIRole -Name custom_role1 -Privilege (Get-VIPrivilege -id $privs_for_role)

the -Privilege accepts only privileges, so we first need to get them using get-viprivilege and giving id name so we will receive privilege object.


3 thoughts on “Adding roles with privileges from powercli

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s