Get iDRAC/ILO (aka Baseboard Management Controller) IP via PowerCLI
[Update: 1 report states issues w/ HP Gen9 systems. Newer Dell, and older HP systems don't seem to have issues. If you have a HP Gen9 system, feel free to contact me via google hangouts and/or twitter to start an interactive session and we can work through figuring out a workaround.]
Summary:
Needed a way to figure out what IP my HP iLO's / Dell iDrac's were configured with. Ended up using an oldie, but a goodie script put together by Carter Shanklin.
PreReqs:
Summary:
Needed a way to figure out what IP my HP iLO's / Dell iDrac's were configured with. Ended up using an oldie, but a goodie script put together by Carter Shanklin.
PreReqs:
- Powershell 2+
- PowerCLI 4+
- Must have Port 443 (https) access to your ESXi hosts.
- If firewalls are an issue you may have the option of running this from your vCenter if it's still running on Windows. If it's the vApp, you'll need to open access to port 443.
- Download Carter's script
Short and Sweet:
$info = Get-VMHostWSManInstance -VMHost (Get-VMHost myESXiServer) -ignoreCertFailures -class OMC_IPMIIPProtocolEndpoint $info # You can remove the -ignoreCertFailures flags if your systems have trusted certs. # This should return you the configuration of your iLO/iDrac, which includes IP address, like so: $info.IPv4Address
Details:
To find out the CIM classes available you can reference VMware's API reference here:
Finding the class was no easy task. I really couldn't find an efficient way to find the information I was looking for so I figured I'd post this as a reference for myself and anyone else needing this type information.
The script simplifies running the get-wsmaninstance cmdlet call to ESXi servers. This is what the cmdlet string would have to look like if you weren't using the script:
# To get the $credential, you have to acquire a CIM ticket session from the host, you can see this in the script. It's probably the part that requires the most work. get-wsmaninstance -Authentication basic -ConnectionURI "https://myESXiServer/wsman" -Credential ($credential) -enumerate -Port 443 -UseSSL -SessionOption (New-WSManSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) -ResourceURI "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_IPMIIPProtocolEndpoint"
Comments
Get-WSManInstance : The connection to the specified remote host was refused. Verify that the WS-Management service is
running on the remote host and configured to listen for requests on the correct port and HTTP URL.
At line:39 char:1
+ Get-WSManInstance -Authentication basic -ConnectionURI $uri -Credential $credent …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WSManInstance], COMException
+ FullyQualifiedErrorId : Exception,Microsoft.WSMan.Management.GetWSManInstanceCommand
Yes, I can confirm that the script is not working on ESXi 6 hosts. The error which I got is below. Any suggestions on how to proceed further ??
Get-WSManInstance : The connection to the specified remote host was refused. Verify that the WS-Management service is running on the remote host and configured to listen for requests on the correct
port and HTTP URL.
At C:\users\USER2\desktop\wsman.psm1:44 char:17
+ Get-WSManInstance -Authentication basic -ConnectionURI $uri -Cre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WSManInstance], COMException
+ FullyQualifiedErrorId : Exception,Microsoft.WSMan.Management.GetWSManInstanceCommand
Get-WSManInstance : The connection to the specified
remote host was refused. Verify that the WS-Management service is running on the remote host and configured to listen for requests on the correct port and HTTP URL.
At C:\users\USER2\desktop\wsman.psm1:44 char:17
+ Get-WSManInstance -Authentication basic -ConnectionURI $uri -Cre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (http://schema.o...rotocolEndpoint:Uri) [Get-WSManInstance], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.GetWSManInstanceCommand
CIM_IPProtocolEndpoint
More detailed information about this class on the following VMware url:
https://www.vmware.com/support/developer/cim-sdk/smash/ga/reference_html/CIM_IPProtocolEndpoint.html
I replaced OMC_IPMIIPProtocolEndpoint with CIM_IPProtocolEndpoint but now the script is displaying all IP addresses which includes ILO IP address as wel. I tried to weed out other IP addresses by using if condition to search only for CreationClassName=OMC_IPMIIPProtocolEndpoint but it didn't work. I searched on Internet but couldn't find any leads on this. Any further idea on how to proceed ?
We also had to replace OMC_IPMIIPProtocolEndpoint with CIM_IPProtocolEndpoint to resolve this issue - any idea what's causing this?
I get information back from Dell iDRAC based servers. I get no info back from something like an Intel NUC, but that's the extent to which I have access to test against.