List all VMDK and in which Datastore they are in?

open powercli

connect-viserver vcenter@domain.com

save the following as VMDK.ps1


$outputFile = "C:\vmdk.csv"

$VMsAdv = Get-VM | Sort-Object Name | % { Get-View $_.ID }
$myCol = @()
ForEach ($VMAdv in $VMsAdv)
{
    ForEach ($Disk in $VMAdv.Layout.Disk)
    {
        $myObj = "" | Select-Object Name, Disk
        $myObj.Name = $VMAdv.Name
        $myObj.Disk = $Disk.DiskFile[0]
        $myCol += $myObj
    }
}
$myCol | Export-Csv $outputFile -NoTypeInformation


run in powershell

Comments

Popular posts from this blog

enable TLS 1.2 and disabling TLS1.0 and SSL 3 on all exchange servers and Clients

HP 3PAR storage Commands to troubleshoot performance issues