Automation

 View Only
Expand all | Collapse all

Hardware sensors

  • 1.  Hardware sensors

    Posted Jul 29, 2013 07:47 PM

    Hellp

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

    tks.



  • 2.  RE: Hardware sensors

    Posted Jul 29, 2013 07:58 PM


  • 3.  RE: Hardware sensors

    Posted Jul 29, 2013 08:07 PM

    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

      }

    }



  • 4.  RE: Hardware sensors
    Best Answer

    Posted Jul 29, 2013 09:50 PM

    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.



  • 5.  RE: Hardware sensors

    Posted Jul 30, 2013 12:59 PM

    Perfect LucD!!!

    Tks!!! You are the man!!!

    Tks, RvdNieuwendijk this help me too.



  • 6.  RE: Hardware sensors

    Posted Nov 26, 2014 05:57 AM

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



  • 7.  RE: Hardware sensors

    Posted Nov 26, 2014 07:28 AM

    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

    }



  • 8.  RE: Hardware sensors

    Posted Nov 26, 2014 09:51 AM

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



  • 9.  RE: Hardware sensors

    Posted Dec 05, 2014 07:15 AM

    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



  • 10.  RE: Hardware sensors

    Posted Dec 05, 2014 07:45 AM

    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..



  • 11.  RE: Hardware sensors

    Posted Dec 05, 2014 11:58 AM

    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.



  • 12.  RE: Hardware sensors

    Posted Dec 05, 2014 12:47 PM

    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.



  • 13.  RE: Hardware sensors

    Posted Dec 08, 2014 03:20 AM

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



  • 14.  RE: Hardware sensors

    Posted Dec 10, 2014 12:07 PM

    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?



  • 15.  RE: Hardware sensors

    Posted Dec 11, 2014 06:22 AM

    Is the CIM service running on these ESX 4.x nodes ?

    Veeam KB1568 gives a good overview of checks to perform.



  • 16.  RE: Hardware sensors

    Posted Dec 11, 2014 05:34 AM

    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.



  • 17.  RE: Hardware sensors

    Posted Dec 11, 2014 06:24 AM

    Not sure what you mean with "directly query", the controller itself doesn't have an interface to poll afaik.



  • 18.  RE: Hardware sensors

    Posted Dec 11, 2014 03:21 PM

    Instead of using CMI Cmdlets is there any way to get ILO-IP Address of ESXi Server by querying to ESXi Server.



  • 19.  RE: Hardware sensors

    Posted Apr 03, 2019 10:47 PM

    Is there any way that we can directly query the BaseBoard Management Controller directly from Powercli and get the Management Controller IP Address in vcenter with multiple host?



  • 20.  RE: Hardware sensors

    Posted Apr 04, 2019 07:22 AM

    I replied to the new thread you created with this question.