VMware Cloud Community
MRoushdy
Hot Shot
Hot Shot
Jump to solution

get harddisk sharing mode, and storage policy

Hello,

I have two inquiries please:

1- I 'm creating a lot of VMDKs, and I need a simple command to enable "multi-writer" mode. I came across a complicated script that I have no time now to tune ot, so, I hope I get a simple command to achieve this.

2- I need to query the disks and list )select) their sharing mode, and current storage policy.

Thank you,

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

1. There is no cmdlet for that if that is what you mean by 'simple' command.
You need to call the API method

2. After a Get-HardDisk you can get the sharing mode via a calculated property

@{N='HDSharingMode';E={$_.ExtensionData.Backing.Sharing}}

You can find the storage policy for harddisks with the Get-SpbmEntityConfiguration cmdlet.

Get-VM -Name MyVM | Get-HardDisk |

Get-SpbmEntityConfiguration


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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

1. There is no cmdlet for that if that is what you mean by 'simple' command.
You need to call the API method

2. After a Get-HardDisk you can get the sharing mode via a calculated property

@{N='HDSharingMode';E={$_.ExtensionData.Backing.Sharing}}

You can find the storage policy for harddisks with the Get-SpbmEntityConfiguration cmdlet.

Get-VM -Name MyVM | Get-HardDisk |

Get-SpbmEntityConfiguration


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

Reply
0 Kudos
MRoushdy
Hot Shot
Hot Shot
Jump to solution

Thanks Boss

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
Reply
0 Kudos
dbutch1976
Hot Shot
Hot Shot
Jump to solution

Hi LucD!

This was very useful for me. I am trying to generate a list of all hosts which I need to patch (everything not presently running 7.0.3c) which contain VMs which have shared multi-writer disks. The following works:

Get-VMHost | Where-Object {$_.version -notmatch "7.0.3"} | get-vm -PipelineVariable vm | Get-HardDisk | Where-Object {$_.ExtensionData.Backing.Sharing -in 'sharingMultiWriter'} | Select Parent,@{N='VMHost';E={$vm.VMHost.Name}} | Out-Default

This only issue is that VMs which have mutliple shared disks appear in the output mulitple times. Is there a way to prune the output so that the result only appears once?

Thanks!

 

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

With Sort-Object and the Unique switch

Get-VMHost | Where-Object {$_.version -notmatch "7.0.3"} | 
Get-VM -PipelineVariable vm | 
Get-HardDisk | 
Where-Object {$_.ExtensionData.Backing.Sharing -in 'sharingMultiWriter'} | 
Select Parent,@{N='VMHost';E={$vm.VMHost.Name}} | 
Sort-Object -Property Parent -Unique |
Out-Default


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