What is bus sharing?
SCSI Bus Sharing (virtual) is a function in VMware vSphere which allows two virtual machines to share a single virtual machine disk. It’s similar in the real world to a directly connected storage to two physical machines using a SAS controller.
Bus Sharing powerCLI script :
Open the PowerCLI icon (Run as Administrator) and you can execute commands manually, run scripts manually or automate your scripts with Task Scheduler (see below).
#Enter vcenter name $vcServer = "Vcenter.test.com" #Enter cluster name $cluster = "Cluster_Namme" Connect-VIServer $vcServer | Out-Null #Create the array $array = @() # Please add cluster name for example here we have used abcrd111. $vms = get-cluster $cluster | get-vm #Loop for BusSharingMode foreach ($vm in $vms) { $disks = $vm | Get-ScsiController | Where-Object {$_.BusSharingMode -eq Physical -or $_.BusSharingMode -eq Virtual} foreach ($disk in $disks){ $REPORT = New-Object -TypeName PSObject $REPORT | Add-Member -type NoteProperty -name Name -Value $vm.Name $REPORT | Add-Member -type NoteProperty -name VMHost -Value $vm.VMHost $REPORT | Add-Member -type NoteProperty -name Mode -Value $disk.BusSharingMode $REPORT | Add-Member -type NoteProperty -name Type -Value BusSharing #it will display the table with the vm names and its details. $array += $REPORT } } $array | out-gridview
Note : It will display the table with the vm names and its details.
Thanks hope you like it.
Rajiv Pandey.