VMware Cloud Community
PowercliCommuni
Contributor
Contributor
Jump to solution

Powercli Command

How to provide a disk with read and write access using powercli command?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Grzesiekk
Expert
Expert
Jump to solution

You need to create a role with this privilege:

Id              : VirtualMachine.Provisioning.DiskRandomAccess

new-virole

then you need to create new permission using this role that has this privilege in it

$privs=Get-VIPrivilege -id VirtualMachine.Provisioning.DiskRandomAccess

New-VIRole -Name My_New_role -Privilege $privs

for example... but this is just to show how can you build new role with this particular priv

--- @blog https://grzegorzkulikowski.info

View solution in original post

0 Kudos
16 Replies
LucD
Leadership
Leadership
Jump to solution

Do you mean a vDisk to a VM ?

Isn't that always RW, or what exactly do you mean ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

PowercliCommuni
Contributor
Contributor
Jump to solution

Its a provisioning privilege.The action is to allow disk access.The description of that action is

Open a disk on a virtual machine for random read and write access.used mostly for remote disk mounting.

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

Its a provisioning privilege.The action is to allow disk access.The description of that action is

Open a disk on a virtual machine for random read and write access.used mostly for remote disk mounting.

0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

To add the disk you can use

$myvm=get-vm 'MyVmToWhichIwantToaddDisk'

new-harddisk -vm $myvm -capacityGB 10 -StorageFormat Thick

or

new-harddisk -vm $myvm -capacityGB 10-ThinProvisioned

if you need think provisioned disk

the rest it's about permissions, if you are administrator  and have administrator role then it should be fine. Now the question is do you need help with giving permissions via powercli or just adding the disk to vm

--- @blog https://grzegorzkulikowski.info
PowercliCommuni
Contributor
Contributor
Jump to solution

Yes.I need help with giving permissions via powercli.Adding the disk to vm is working fine.

0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

Can you tell exact privilege name ? Like when you are in vsphere client and you open the role settings, which one is it, not the description by in which section is this privilege and what name does it have, also please say which version on virtual center do you use

--- @blog https://grzegorzkulikowski.info
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You will first have to create a role that has the required privilege.

Can you use any of the existing roles in vCenter or do you need to create a new role ?

For both you will at least need an account with administrator authority on vCenter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

privilege : Allow disk access

vCenter Version : 2.5

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

I have to create a new role.Readonly role is there.how to give a disk permission with read and write?

0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

You need to create a role with this privilege:

Id              : VirtualMachine.Provisioning.DiskRandomAccess

new-virole

then you need to create new permission using this role that has this privilege in it

$privs=Get-VIPrivilege -id VirtualMachine.Provisioning.DiskRandomAccess

New-VIRole -Name My_New_role -Privilege $privs

for example... but this is just to show how can you build new role with this particular priv

--- @blog https://grzegorzkulikowski.info
0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

okay.I understood.Thanks for your help

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

for get-viprivilege there is no argument like -id.Can we use -Name instead?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

There is an Id parameter. Do a

Get-Help Get-VIPrivilege -Parameter id

Or have a look at the the Get-ViPrivilege cmdlet online reference.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

Yes.I got it.I had seen an older version powercli before.Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Which PowerCLI version are you using ?

Do a

Get-PowerCLIVersion

The latest is 5.1, you should use that version.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
PowercliCommuni
Contributor
Contributor
Jump to solution

I had seen the documentation of powercli version 4.1.Actually i dont have the setup of powercli.

0 Kudos