Hello, fortunately we have very few of these CIB VMs, leftovers from the past. however I can't find the right way to spot them with PowerCLI.
In VMs with RDMs is easy as I grab the:
foreach($vm in $vms){
foreach($dev in $vm.Config.Hardware.Device){
if(($dev.gettype()).Name -eq "VirtualDisk"){
if($dev.Backing.CompatibilityMode -eq "physicalMode"){
however in CIB VMs the $dev.Backing.CompatibilityMode -eq "virtualMode" does not exist. Actually if I
$test = Get-VM "CAB VM" | Get-HardDisk
I then can get the:
$test.extensiondata.backing.compatibilitymode
which does not exist in the case of a CIB VM, this is what I have available if I $test.extensiondata.backing on a CIB VM:
DiskMode : persistent
Split : False
WriteThrough : False
ThinProvisioned : False
EagerlyScrub : True
Uuid : 6000C291-247a-d2fe-a957-6ea668bd39da
ContentId : 4d937daff0119c687e1381c025ee79e1
ChangeId :
Parent :
DeltaDiskFormat :
DigestEnabled : False
DeltaGrainSize :
DeltaDiskFormatVariant :
Sharing :
KeyId :
LinkedView :
FileName : [DS name] VM folder/vmName_7.vmdk
Datastore : Datastore-datastore-2202
BackingObjectId : 2-2032-0
Did you try like this?
Get-VM |
where{Get-ScsiController -VM $_ | where{'Physical','Virtual' -contains $_.BusSharingMode}} |
Select Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Can't you check the Bus Sharing mode on the SCSI controllers to which these harddisks are connected?
Instead of 'none', it should say 'physical' or 'virtual'.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
easy from the gui I'm exploring every View portion to find it.. I'll get there. However is there any map of these?
Did you try like this?
Get-VM |
where{Get-ScsiController -VM $_ | where{'Physical','Virtual' -contains $_.BusSharingMode}} |
Select Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
many thanks Luc, I was exploring get-harddisk and eventually I would have gotten to get-scsicontroller thanks again! ...and I guess the map I was looking for will slowly build in my head right?
Well this one didn't use any ExtensionData or Get-View properties, all the required data was in the .Net object returned by the cmdlets..
But to get to know the API objects, there's the API Reference and there is the SDK Programming Guide.
And although that last one was not written with PowerCLI in mind, you can still use it to learn how things fit together and where to find them
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I finally found it also using the View option, I'm sharing it as it is faster
$vms = Get-Cluster myCluster | Get-VM | Get-View
foreach($vm in $vms)
{
foreach($dev in $vm.Config.Hardware.Device)
{
if(($dev.gettype()).Name -eq "VirtualDisk")
{
if($vm.config.Hardware.Device.sharedbus -eq "virtualSharing")
{
$row = "" | select VMName, HWLevel, ESXiHost, HDDeviceName, HDFileName
$row.VMName = $VM.Name
$row.HWLevel = $VM.config.Version
$row.ESXiHost = (get-vm $vm.Name).VMHost
$row.HDDeviceName = $dev.Backing.DeviceName
$row.HDFileName = $dev.Backing.FileName
$report += $row
}
}
}
}
$report