1 2 Previous Next 17 Replies Latest reply on Sep 13, 2019 9:36 AM by LucD

    Finding Lun details using powercli

    Sureshkumar M Expert
    vExpert

      Hi,

       

      I want to extract lun details from all hosts connected to a particular vcenter server. I found the following article, however it talks about one cluster, what modification is needed to run at vcenter level without providing cluster name as a parameter

       

      LUN report - datastore, RDM and node visibility - LucD notes

        • 1. Re: Finding Lun details using powercli
          LucD Guru
          User ModeratorsvExpertCommunity Warriors

          You could run the function against all clusters in your vCenter.

          Something like this

           

          Get-Cluster | %{

              .\Cluster-LUN-List.ps1 $_.Name

          }

           

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Finding Lun details using powercli
            Sureshkumar M Expert
            vExpert

            Hi,

             

            I tried executing the script and got following error

             

            The property 'ClusterName' cannot be found on this object. Verify that the

            property exists and can be set.

            At C:\TEMP\Cluster-LUN-List.ps1:61 char:2

            +     $lun.ClusterName = $clusName

            +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

                + FullyQualifiedErrorId : PropertyNotFound

             

            The property '129' cannot be found on this object. Verify that the property

            exists and can be set.

            At C:\TEMP\Cluster-LUN-List.ps1:64 char:3

            +         $lun.$esxName = "ok"

            +         ~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

                + FullyQualifiedErrorId : PropertyNotFound

             

            The property 'CanonicalName' cannot be found on this object. Verify that the

            property exists and can be set.

            At C:\TEMP\Cluster-LUN-List.ps1:65 char:27

            +         if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}

            +                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

                + FullyQualifiedErrorId : PropertyNotFound

             

            The property 'UsedBy' cannot be found on this object. Verify that the propert

            exists and can be set.

            At C:\TEMP\Cluster-LUN-List.ps1:66 char:20

            +         if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}

            +                          ~~~~~~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

                + FullyQualifiedErrorId : PropertyNotFound

             

            The property 'SizeMB' cannot be found on this object. Verify that the propert

            exists and can be set.

            At C:\TEMP\Cluster-LUN-List.ps1:67 char:20

            +         if(!$lun.SizeMB){$lun.SizeMB = $_.Value[2]}

            +                          ~~~~~~~~~~~~~~~~~~~~~~~~~

             

            do I need any specific version or powercli to run this script ?

             

            Regards,

            Suresh

            • 3. Re: Finding Lun details using powercli
              LucD Guru
              vExpertCommunity WarriorsUser Moderators

              No, but it looks like the Add-Type didn't work.

               

              Could you eventually attach the .ps1 file you are calling?

              There might have been some copy/paste issues

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 5. Re: Finding Lun details using powercli
                LucD Guru
                User ModeratorsCommunity WarriorsvExpert

                Ok, which PowerShell version are you suing?

                Display the content of $PSVersionTable

                 

                Did you see the following as the first error?

                add-type.png

                Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                • 6. Re: Finding Lun details using powercli
                  Sureshkumar M Expert
                  vExpert

                  PowerCLI C:\TEMP> $PSVersionTable

                   

                  Name                           Value

                  ----                           -----

                  PSVersion                      4.0

                  WSManStackVersion              3.0

                  SerializationVersion           1.1.0.1

                  CLRVersion                     4.0.30319.34014

                  BuildVersion                   6.3.9600.16394

                  PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}

                  PSRemotingProtocolVersion      2.2

                   

                  Did you see the following as the first error?

                   

                  I could not grab that info while running, can you let me know how can I redirect the error message to a file to check that please.

                  • 7. Re: Finding Lun details using powercli
                    LucD Guru
                    User ModeratorsCommunity WarriorsvExpert

                    You can send the output to a text file.

                     

                     

                    Start-Transcript -Append -Path C:\Temp\output.txt

                    Get-Cluster | %{

                        .\Cluster-LUN-List.ps1 $_.Name 2>&1 | Write-Output

                    }

                    Stop-Transcript

                    Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                    • 8. Re: Finding Lun details using powercli
                      Sureshkumar M Expert
                      vExpert

                      Attached output file

                      • 9. Re: Finding Lun details using powercli
                        LucD Guru
                        User ModeratorsvExpertCommunity Warriors

                        Looks like a funny character slipped in during the copy/paste of the code.

                        The following line seems to indicate that

                        Invalid token '129' in class, struct, or interface member declaration

                        Try with the attached .ps1 file instead

                        Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                        • 10. Re: Finding Lun details using powercli
                          Sureshkumar M Expert
                          vExpert

                          Attached new output file. Still could not run.

                          • 11. Re: Finding Lun details using powercli
                            LucD Guru
                            vExpertUser ModeratorsCommunity Warriors

                            Do you happen to have ESXi nodes that have an IP address as the hostname?

                            Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                            • 12. Re: Finding Lun details using powercli
                              Sureshkumar M Expert
                              vExpert

                              No, we have only two hosts in the VC and none of them has IP as the hostname.

                              • 13. Re: Finding Lun details using powercli
                                LucD Guru
                                Community WarriorsUser ModeratorsvExpert

                                What does this return?

                                 

                                Get-Cluster -Name CLuster01 | Get-VMHost

                                 

                                Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                                • 14. Re: Finding Lun details using powercli
                                  Sureshkumar M Expert
                                  vExpert

                                  It returns the IP address of the ESXi hosts, one thing I forgot to mention, the hosts are connected using IP to VC instead of hostname. Would that cause this issue ?

                                  1 2 Previous Next