Script to find out datastores to NAA ID's

1. Open the vSphere PowerCLI command-line. 

2. Run the command to get the ouput at Cluster Level:

Get-Cluster "ClusterName" | Get-VMHost | Get-Datastore | Where {$_.Name -notmatch "-Local" -and $_.Name -notmatch "NFS"} | Select Name,@{N="DiskName";E={$_.ExtensionData.Info.Vmfs.Extent.DiskName}}

This command produces a list of virtual machines with RDMs, along with the backing SCSI device for the RDMs.

3. If you need to save the output to a file, the command can be modified to:

Get-Cluster "ClusterName" | Get-VMHost | Get-Datastore | Where {$_.Name -notmatch "-Local" -and $_.Name -notmatch "NFS"} | Select Name,@{N="DiskName";E={$_.ExtensionData.Info.Vmfs.Extent.DiskName}} | Out-File –FilePath C:\DS-list.txt

4. Run the command to get the ouput at DataCenter Level


Get-Datacenter "DatacenterName" | Get-VMHost | Get-Datastore | Where {$_.Name -notmatch "-Local" -and $_.Name -notmatch "NFS"} | Select Name,@{N="DiskName";E={$_.ExtensionData.Info.Vmfs.Extent.DiskName}} | Out-File –FilePath C:\DS-list.txt

No comments:

Post a Comment