1 2 Previous Next 19 Replies Latest reply on Apr 4, 2019 12:21 AM by LucD

    Hardware sensors

    chiisaryuu Novice

      Hellp

       

      How I get "management controller ip interface" in hardware status > sensors with powercli?

       

       

      tks.

        • 1. Re: Hardware sensors
          LucD Guru
          vExpertCommunity WarriorsUser Moderators
          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Hardware sensors
            RvdNieuwendijk Virtuoso
            User ModeratorsvExpert

            You can get a list of the status of all of the hardware sensors with:

             

            $VMHost = Get-VMHost -Name esxi.yourdomain.com

            $HealthStatusSystem = Get-View $VMHost.ExtensionData.ConfigManager.HealthStatusSystem

            $HardwareStatusInfo = $HealthStatusSystem.Runtime.HardwareStatusInfo

            $SystemHealthInfo = $HealthStatusSystem.Runtime.SystemHealthInfo

            $SystemHealthInfo.NumericSensorInfo | ForEach-Object {

              if ($_) {

               $Sensor = $_

                $Report = "" | Select-Object VMHost,Device,Type,Status

                $Report.VMHost = $VMHost.Name

                $Report.Device = $Sensor.Name

                $Report.Type   = "Sensor"

                $Report.Status = $Sensor.HealthState.Key

                $Report

              }

            }

            1 person found this helpful
            • 3. Re: Hardware sensors
              LucD Guru
              User ModeratorsvExpertCommunity Warriors

              Try the following on a client where you have PowerShell v3 installed.

               

              import-module CimCmdlets
              $ipaddress = "192.168.1.1"
              $HostUsername = "root"
              $CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
              $Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $Ipaddress -port 443 -SessionOption $CIOpt
              Get-CimInstance -CimSession $Session -ClassName CIM_ServiceAccessPoint |
              Where {$_.SystemName -match "Management"} | Select IPv4Address

              The $ipaddress variable should contain the IP address of the ESXi server.

              You'll be prompted to provide the root password when the CIM session is established.

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 4. Re: Hardware sensors
                chiisaryuu Novice

                Perfect LucD!!!

                 

                Tks!!! You are the man!!!

                 

                Tks, RvdNieuwendijk this help me too.

                • 5. Re: Hardware sensors
                  Sivaramsharmar Enthusiast

                  Hello, How can I get "Management Controller IP Interface" for All ESXi Hosts in one vCenter Server Using PowerCLI. Regards, Siva

                  • 6. Re: Hardware sensors
                    LucD Guru
                    Community WarriorsUser ModeratorsvExpert

                    Does the above script return the Management IP address for a specific ESXi node ?

                    If yes, you could run that script in a loop that goes through all your ESXi nodes.

                    Something like this (it assumes that same account can be used on all ESXi nodes)

                     

                    import-module CimCmdlets

                    $HostUsername = "root"

                    $HostUserPswd = 'MyPswd'

                    $secstr = New-Object -TypeName System.Security.SecureString

                    $HostUserPswd.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

                    $cred = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist $HostUsername,$secstr

                     

                    $CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl

                     

                    foreach($esx in Get-VMHost){

                        $Session = New-CimSession -Authentication Basic -Credential $cred -ComputerName $esx.NetworkInfo.VMHost.Name -port 443 -SessionOption $CIOpt

                        Get-CimInstance -CimSession $Session -ClassName CIM_ServiceAccessPoint |

                        Where {$_.SystemName -match "Management"} | Select @{N='VMHost';E={$esx.Name}},IPv4Address

                    }

                     

                    Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                    • 7. Re: Hardware sensors
                      Sivaramsharmar Enthusiast

                      Thanks LUCD, I will try this Script and get back to you .

                      • 8. Re: Hardware sensors
                        Sivaramsharmar Enthusiast

                        Sorry for the delayed response. Thanks LUCD Script is working fine. I have 2 more queries If we want to get the current logged on user using batch file we can use %username%, If it is powershell we can use $env:username but for powercli I am not able to find the command. Please suggest. One More query is I want an output as below for VM Details VMName,Created Date,Created By & Type(CLone,Deploy,Created) I have tried the below command for single VM $vm = vmname Get-VIEvent $vm -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "Deploying*"} |Select CreatedTime, UserName, FullFormattedMessage I am not getting the result as I can see it on task and events that VM Creation date was not there. In vCenter Database DataRetention policy is set to 60 days and this VM has created  on 6 months back. So If I want to get the vm created date and created by details how can I fetch it from powercli. Thanks in Advance

                        • 9. Re: Hardware sensors
                          LucD Guru
                          Community WarriorsUser ModeratorsvExpert

                          The $env:username should work in PowerCLI as wel, since PowerCLI is just a snapin running in PowerShell.

                           

                          If your environment keeps the events for 60 days, I'm afraid it will be difficult to find the creation date of the VM, when it was created more than 60 days ago..

                          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                          • 10. Re: Hardware sensors
                            Sivaramsharmar Enthusiast

                            Thanks for your response. Here I got one more requirement from Business. I need to produce Stats in bar and Pie Chart. I have seen in one of the post it is possible with MSChart. I have installed MS Chart and loaded [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization") these 2 functions in Powercli but while exporting vm stats to chart using "out-chart" function I am getting error as out-chart is not recognized as name of the cmdlet. I have looked for this in your posts for MSChart using powercli but not able to find it. Could you please help me.

                            • 11. Re: Hardware sensors
                              LucD Guru
                              Community WarriorsUser ModeratorsvExpert

                              The Out-Chart cmdlet is present in the PowerGadgets module.

                               

                              With MS Chart it requires a different approach.

                              There is a good example here.and here.

                              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                              • 12. Re: Hardware sensors
                                Sivaramsharmar Enthusiast

                                Thank you so much for your Response Lucd.. I got it now. Thanks for all your Support.

                                • 13. Re: Hardware sensors
                                  nava_thulasi39 Expert

                                  Thanks LucD for the perfect script.

                                   

                                  But I wonder it works for esxi, we have few servers with ESX 4. Is there any way to find the iLO IP address for ESX hosts?

                                  • 14. Re: Hardware sensors
                                    Sivaramsharmar Enthusiast

                                    Hi Lucd,

                                     

                                    Is there any way that we can directly query the BaseBoard Management Controller directly from Powercli and get the Management Controller IP Address.

                                    Please suggest on this.

                                    1 2 Previous Next