Skip to content

Instantly share code, notes, and snippets.

@fr0gger03
Created September 17, 2014 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fr0gger03/4e1556a3fff12cc14ea4 to your computer and use it in GitHub Desktop.
Save fr0gger03/4e1556a3fff12cc14ea4 to your computer and use it in GitHub Desktop.
PowerCLI: Get-View samples for discovering VM to VMFS to LUN NAA mappings...
# you must connect and authenticate to a vCenter server
# use Connect-VIServer to do so
# establish Export file name
$csvname = Read-Host 'Please provide the file path and name for your CSV export'
# Use Get-View, and filter by datastore type, then
# select specific properties and export to CSV
Get-View -ViewType datastore |Select-Object name,@{n='NAA';e={$_.info.vmfs.extent.diskname}} |Sort-Object name | Export-Csv $csvname
# establish Export file name
$csvname = Read-Host 'Please provide the file path and name for your CSV export'
# Use Get-View, and filter by virtual machine type, then
# select specific properties and export to CSV
Get-View -ViewType virtualmachine |Select-Object name,@{n="disk layout";e={$_.layoutex.file.name}},@{n="VMDK Size";e={$_.layoutex.file.size}} |Sort-Object name | Export-Csv $csvname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment