List the multipath policy per datastore

Some jobs require several mouse-clicks to get the information you need. If this is for a limited amount of checks, doing it this way is more than acceptable. However in my situation I needed to check a vSphere 5.0 vcenter with 9 clusters, 49 hosts and 931 virtual machines. My task was to document each datastore together with the defined MultipathPolicy. I thought it would be a simple task with a PowerShell command that looks like this: get-datastore | select name,multipathpolicy or get-scsilun -luntype disk | select name,multipathpolicy.

In fact the solution is more complex than expected. If you want the human readable names of the datastores, you need to filter out the name by using the ExtensionData.

FOREACH($vmHost in (Get-VMHost))
Write-Warning "Grabbing Data for $vmhost"
FOReach($lun in ($vmHost|Get-ScsiLun -luntype Disk))
$collect=""| select "Host","Datastore","Canonicalname", "MultipathPolicy"
$Datastore=(Get-Datastore|?{($|select -expand diskname) -like $canon}).name
$output | Out-File C:\datastoresprod.csv

Credit goes to the persons who deserve it.

PowerCLI – list virtual machines with physical SCSI controllers & inventory path within vcenter

For a project, we needed to implement a VEEAM Backup & Replication setup. During the project we encountered some virtual machines with Physical RDMs. VEEAM cannot handle this, so it was needed to write a script allowing us to list all virtual machines with their most interesting parameters, such as:

  • Virtual Machine Name
  • Version
  • PowerState
  • HardDisks
  • ProvisionedSpaceGB
  • Datacenter
  • Cluster
  • InventoryPath
  • HasPhysicalController

The function Get-VMFolderPath can be found on this blog.

Continue reading