VMware Cloud Community
td_sk
Contributor
Contributor
Jump to solution

need to check multiwriter is enabled in VM

Hi All,

   Thanks in Advance.

   For creating build verification documents, I need to check if the particular VM is enabled with multi writer disk's or not .Any help much appreciated.

I need a report some thing like the following.

   

Header 1Header 2Header 3Header 2
Capacity GBStorageFormatFilenameMulti-writer
40 GBEagerZeroedThick[LUN-1]vmtest.vmdkno
60 GBEagerZeroedThick[LUN-1]vmtest_1.vmdkyes
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM | Get-HardDisk | %{

    $ctrl = Get-ScsiController -HardDisk $_

    $_ | Select @{N='VM';E={$_.Parent.Name}},

        Name,

        StorageFormat,

        FileName,

        @{N='Multi-Writer';E={

           Get-AdvancedSetting -Entity $_.Parent -Name "scsi$($ctrl.ExtensionData.BusNumber):$($_.ExtensionData.UnitNumber).sharing" |

           Select -ExpandProperty Value

        }}

}


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

View solution in original post

0 Kudos
24 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM | Get-HardDisk | %{

    $ctrl = Get-ScsiController -HardDisk $_

    $_ | Select @{N='VM';E={$_.Parent.Name}},

        Name,

        StorageFormat,

        FileName,

        @{N='Multi-Writer';E={

           Get-AdvancedSetting -Entity $_.Parent -Name "scsi$($ctrl.ExtensionData.BusNumber):$($_.ExtensionData.UnitNumber).sharing" |

           Select -ExpandProperty Value

        }}

}


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Hi,

Excellent, thanks a lot.

Can you please add two more information in that script Cluster and host please and can be export in .csv

Thanks and Regards,

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Sure, try like this

Get-VM | Get-HardDisk | %{

    $ctrl = Get-ScsiController -HardDisk $_

    $_ | Select @{N='VM';E={$_.Parent.Name}},

        @{N='VMHost';E={$_.Parent.VMHost.Name}},

        @{N='Cluster';E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}},

        Name,

        StorageFormat,

        FileName,

        @{N='Multi-Writer';E={

           Get-AdvancedSetting -Entity $_.Parent -Name "scsi$($ctrl.ExtensionData.BusNumber):$($_.ExtensionData.UnitNumber).sharing" |

           Select -ExpandProperty Value

        }}

}


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Hi,

Superb, I tried to export it in .CSV by adding below command at the end, but no luck.

"$ctrl | Export-CSV C:\MultiWriter.csv"

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The ForEach block doesn't place anything on the pipeline.

One way of capturing and exporting the result is like this

$report = Get-VM | Get-HardDisk | %{

    $ctrl = Get-ScsiController -HardDisk $_

    $_ | Select @{N='VM';E={$_.Parent.Name}},

        @{N='VMHost';E={$_.Parent.VMHost.Name}},

        @{N='Cluster';E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}},

        Name,

        StorageFormat,

        FileName,

        @{N='Multi-Writer';E={

           Get-AdvancedSetting -Entity $_.Parent -Name "scsi$($ctrl.ExtensionData.BusNumber):$($_.ExtensionData.UnitNumber).sharing" |

           Select -ExpandProperty Value

        }}

}

$report | Export-Csv -Path C:\MultiWriter.csv -NoTypeInformation -UseCulture


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Hi,

Thanks a looooot......It works great.

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Hi,

I am getting empty in multiwriter column and no data, can you please it in the script.

Thanks in advance.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

If there is multi-writer set, you will get an empty cell.

Only when there is an entry will you see True or False in the column.


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

I couldn't get you, you meant, If there is no multi-writer set, will get an empty cell...?

Where I will get an entry True or False? In my case, I have number of multi writer enabled VM's but I got empty cells on those VM's also.

Can you please clarify me..

0 Kudos
LucD
Leadership
Leadership
Jump to solution

If multi-write is set for a vDisk on a VM, you should have an Advanced Setting on the VM that looks like scsix:y.sharing = “multi-writer”.

The value on that key is what you should see in the column (it's not True or False, I was wrong).

When you do a Get-AdvancedSetting for a VM with multi-write enabled, do you see such entries being returned?

Get-AdvancedSetting -Entity (Get-VM MyVM) | where{$_.Name -match "^scsi.*sharing"}


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Yeah, its there in VMX config file. I have created that shared disk.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Can you show me a sample entry?

I would like to verify that the calculated property is querying for the correct key.


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Do I need to add this below line in the script.?

Get-AdvancedSetting -Entity (Get-VM MyVM) | where{$_.Name -match "^scsi.*sharing"}

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, just run that line by itself, and replace the MyVM by one of your VMnames (one where you know that multi-writer is defined).


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

I am not getting any out after running that given single line script. Its just simply came out from run time after completion of script execution.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Leave out the where-clause and see if you can find the multi-write entry in the output.


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

0 Kudos
Vel_VMware
Enthusiast
Enthusiast
Jump to solution

Yeah, I could see scsi.x:x - multi-writer, I got the response blank in multi writer while running script.

What should I get the out for this, True or False or blank in multiwriter column.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Looks like the Advanced Settings doesn't list that value anymore, at least not in vSphere 6.5.

Try this alternative method

Get-VM | Get-HardDisk | %{

    $ctrl = Get-ScsiController -HardDisk $_

    $_ | Select @{N='VM';E={$_.Parent.Name}},

        Name,

        StorageFormat,

        FileName,

        @{N='Multi-Writer';E={$_.ExtensionData.Backing.Sharing}}

}


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

0 Kudos
exploreeverythi
Contributor
Contributor
Jump to solution

I had this problem a while ago. We were able to check 'multi-writer' flag from 'Advanced Setting', when the VMs were on ESXi 5.5. After an upgrade to 6.0, the multi-writer values disappeared from Advanced Setting and the only way we could check is by opening the vmx file of the VM.

I did try $_.ExtensionData.Backing.Sharing but it is showing empty, but the VM does have multi-writer enabled on the vmx.

0 Kudos