Automation

 View Only
  • 1.  get harddisk sharing mode, and storage policy

    Posted Sep 29, 2020 09:01 AM

    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,



  • 2.  RE: get harddisk sharing mode, and storage policy
    Best Answer

    Posted Sep 29, 2020 09:23 AM

    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



  • 3.  RE: get harddisk sharing mode, and storage policy

    Posted Sep 29, 2020 09:44 AM

    Thanks Boss



  • 4.  RE: get harddisk sharing mode, and storage policy

    Posted Jul 18, 2022 03:52 PM

    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!

     

     



  • 5.  RE: get harddisk sharing mode, and storage policy

    Posted Jul 18, 2022 04:26 PM

    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