We have a requirement for Storage Vendor Migration, We need all LUN naaid's and vendor names, Environment having RDM Disks, Datastores and unused LUN's mapped to the Host.
It's possible to provide the Script it should take all LUN Naaid connected ESXi Host for datastore, RDM, unused LUN and RDM disk.
Have a look at LUN Report – Datastore, RDM And Node Visibility
If that brings what you want, we can add the Vendor name.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LUcD,
Thanks for your quick reply, Below screen appears on While running the Script. please guide me .. Anything wrong from my end.
PowerCLI C:\temp> .\Lunreport.ps1
Get-Cluster : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is
not null or empty, and then try the command again.
At C:\temp\Lunreport.ps1:10 char:27
+ $esxServers = Get-Cluster $clusName | Get-VMHost | Sort-Object -Prope ...
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Cluster], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetCluster
You cannot call a method on a null-valued expression.
At C:\temp\Lunreport.ps1:12 char:1
+ $LunInfoDef += ("`n`tpublic string " + ($_.Name.Split(".")[0]) + ";")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Get-ScsiLun : Cannot validate argument on parameter 'VmHost'. The argument is null or empty. Provide an argument that
is not null or empty, and then try the command again.
At C:\temp\Lunreport.ps1:20 char:12
+ $esxImpl | Get-ScsiLun | where {$_.LunType -eq "Disk"} | %{
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ScsiLun], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetSc
siLun
Get-Datastore : Cannot validate argument on parameter 'RelatedObject'. The argument is null or empty. Provide an
argument that is not null or empty, and then try the command again.
At C:\temp\Lunreport.ps1:27 char:12
+ $esxImpl | Get-Datastore | where {$_.Type -eq "VMFS"} | Get-View | %{
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetDatasto
re
Get-Cluster : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is
not null or empty, and then try the command again.
At C:\temp\Lunreport.ps1:36 char:13
+ Get-Cluster $clusName | Get-VM | Get-View | %{
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Cluster], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetCluster
Export-Csv : The process cannot access the file 'C:\Temp\-LUN.csv' because it is being used by another process.
At C:\temp\Lunreport.ps1:57 char:5
+ } | Export-Csv $csvName -NoTypeInformation -UseCulture
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Export-Csv], IOException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand
The script expects a parameter, the name of the cluster you want to report upon.
And you should have done the Connect-VIServer before running the script.
PowerCLI C:\temp> .\Lunreport.ps1 -ClusName YourCluster
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much, Working expected It's possible to get all clusters while running same time.
You can do
Get-Cluster | %{
.\Lunreport.ps1 -ClusName $_.Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference