jcouch
Enthusiast
Enthusiast

Query for Unformatted Luns

Looking for a way to query a vcenter for unformatted volumes. I found this script on Luc's site, but it looks like the ConfigManager.StorageSystem only looks at luns that have VMFS on them. Any suggestions?

http://www.lucd.info/2010/06/26/create-vmfs-datastores-on-a-free-space-partition/

Thanks,
Jeff

0 Kudos
2 Replies
LucD
Leadership
Leadership

With a smal change that function can return free LUNs.

Something like this

function Get-FreeScsiLun {
  param (
  [parameter(ValueFromPipeline = $true,Position=1)]
  [ValidateNotNullOrEmpty()]
  [VMware.VimAutomation.Client20.VMHostImpl]
  $VMHost  )

  process{
    $storMgr = Get-View $VMHost.ExtensionData.ConfigManager.DatastoreSystem
    $storMgr.QueryAvailableDisksForVmfs($null) | %{
      New-Object PSObject -Property @{
        VMHost = $VMHost.Name
        CanonicalName = $_.CanonicalName
       
Uuid = $_.Uuid
       
CapacityGB = [Math]::Round($_.Capacity.Block * $_.Capacity.BlockSize / 1GB,2)       }     }   } } Get-VMHost MyEsx | Get-FreeScsiLun


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

0 Kudos
jcouch
Enthusiast
Enthusiast

As always, Thank you sir!

0 Kudos