Before you continue please consider clicking on one of the horrible ads. I know they are a pain but they help me pay for the hosting of this site. It owes me a lot of money. Sob story over.
Previously I created the following for retrieving a hardware inventory from an iDrac using the Redfish API.
It appears there are some issues with this.
- It only works with iDrac v9
- Its over complicated...
So I took another swing at it and came up with the following:
function Get-iDracHardwareInventory
{
param ($Username,$password,$iDracBaseUrl)
$sessionsUrl = "$iDracBaseUrl/redfish/v1/Systems/System.Embedded.1"
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($Username, $secpasswd)
$session = Invoke-WebRequest -Uri $sessionsUrl -Credential $credential -Method Get -UseBasicParsing
$HardwareInv = $session.Content | ConvertFrom-Json
return $HardwareInv
}
This is doesn't use sessions like the last version and as a result only needs to access the API once making it a lot quicker you need to query a lot of servers. This will also work on older idrac versions (iDrac 7/8/9).