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.
- 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.
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
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/sim-schema/2/OMC_IPMIIPProtocolEndpoint"