VMware Cloud Community
basse
Contributor
Contributor
Jump to solution

Setting Disk Shares on VM's in a Resource Pool

Hello,

*Very* new to PowerShell so pardon if this is trivial ...

I would like to set Disk Shares to i.e. 'Low' on a VM that is member of a specific Resource Pool.

I.e. all VM's contained in a specific Resource Pool should have : -DiskSharesLevel low

Brgds.

Bjarke

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Bjarke,

If your resource pool is called "test" then you can set the disk shares level to low for all the VM's in this resource pool with:

Get-ResourcePool test | Get-VM | Get-VMResourceConfiguration | `

Set-VMResourceConfiguration -DisksharesLevel Low



Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
4 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Bjarke,

If your resource pool is called "test" then you can set the disk shares level to low for all the VM's in this resource pool with:

Get-ResourcePool test | Get-VM | Get-VMResourceConfiguration | `

Set-VMResourceConfiguration -DisksharesLevel Low



Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
basse
Contributor
Contributor
Jump to solution

... and still, not able to get it to work ...

The code :

Get-ResourcePool Low | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -DiskSharesLevel Low

Parses the correct VMs - but when I check the DiskShares they are untouched 😞

Brgds.

Bjarke

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You have to specify the hard disks for which you want to change the shares level.

Get-ResourcePool test | Get-VM | %{
    Get-VMResourceConfiguration -VM $_ | `
    Set-VMResourceConfiguration -Disk (Get-HardDisk $_) -DisksharesLevel Low
}


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

basse
Contributor
Contributor
Jump to solution

Solved ! Thx a bundle !

Brgds.

Bjarke

0 Kudos