Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Re: vm to lun id number

$
0
0

Fine, thanks.

Try this. The speed of the script is terrible, but it can definitely be optimised. Consider this a proof-of-concept version

 

foreach($vminGet-VM){  $luns=Get-ScsiLun-VmHost$vm.Host-LunTypeDisk
  $vm.ExtensionData.Config.Hardware.Device|where {$_.gettype().Name-eq"VirtualDisk"} |%{    if("physicalMode","virtualmode"-contains$_.Backing.CompatibilityMode){      $disk=$_.Backing.LunUuid.Substring(10,32)      $luns|where {$_.CanonicalName.Split(".")[1] -eq$disk} |
     
Select@{N="VM";E={$vm.Name}},
      @{N="LunId";E={[int](Select-String":L(?<lunID>\d+)$"-InputObject$_.RuntimeName).Matches[0].Groups['lunID'].Value}}    }  } }

Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>