Advertisement
Guest User

Get Server iLO Enclosure HW Info

a guest
Mar 29th, 2014
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ###################
  3. #Get Host, iLO, Blade Enc Information - return data to your #screenversion
  4. #Version 0.1
  5. #Platform: Powershell
  6. #2014-02-26
  7. # to run use .\script.ps1 ilohostname
  8. ###################
  9. param($snfi1)
  10.  
  11. $targetiLO=$snfi1
  12.  
  13. Write-Host "Our target iLO is: $targetiLO"
  14.  
  15. #Creating the RemoteLookup Object to accept XML
  16. $rmlu=New-object System.XML.XMLDocument
  17.  
  18. #Building the standard iLO URL to retrieve the XML data
  19. $iloURL=$("http://" + $targetiLO + "/xmldata?item=All")
  20. Write-Host "Our target XML is located here: "$iloURL
  21.  
  22. #Trapping any errors that occur during lookup and exiting
  23. try
  24. {
  25. #Loading the XML data from the URL into our RemoteLookup object
  26. $rmlu.Load("$iloURL")
  27.  
  28. #Outputting the details we're concerned with
  29. Write-Host "------------------------------------------------------------------------------------"
  30. Write-Host "Outputting Host Information"
  31. Write-Host "------------------------------------------------------------------------------------"
  32. Write-Host "Host Serial: "$rmlu.RIMP.HSI.SBSN
  33. Write-Host "Host Model: "$rmlu.RIMP.HSI.SPN
  34. Write-Host "------------------------------------------------------------------------------------"
  35. Write-Host "Here's iLO Data for $targetiLO"
  36. Write-Host "------------------------------------------------------------------------------------"
  37. Write-Host "Model: "$rmlu.RIMP.MP.PN
  38. Write-Host "Firmware: "$rmlu.RIMP.MP.FWRI $rmlu.RIMP.MP.BBLK
  39. Write-Host "Serial: "$rmlu.RIMP.MP.SN
  40. Write-Host "------------------------------------------------------------------------------------"
  41. if ($rmlu.RIMP.BLADESYSTEM.MANAGER.ENCL) {
  42. Write-Host "`Here's Chassis Data for "$rmlu.RIMP.BLADESYSTEM.MANAGER.ENCL
  43. Write-Host "------------------------------------------------------------------------------------"
  44. Write-Host "`ENC NAME: "$rmlu.RIMP.BLADESYSTEM.MANAGER.ENCL
  45. Write-Host "RACK: "$rmlu.RIMP.BLADESYSTEM.MANAGER.RACK
  46. Write-Host "BAY: "$rmlu.RIMP.BLADESYSTEM.BAY
  47. Write-Host "MANAGER TYPE: "$rmlu.RIMP.BLADESYSTEM.MANAGER.TYPE
  48. Write-Host "MGMT IP: "$rmlu.RIMP.BLADESYSTEM.MANAGER.MGMTIPADDR
  49.  }
  50. }
  51. catch
  52. {
  53. if ($error[0].Exception -match "The remote name could not be resolved:")
  54.           {
  55.                    Write-Error "Please check the URL, it seems invalid: "$iloURL
  56.                    exit 1;
  57.           }
  58.           else
  59.           {
  60.                    Throw ("Oh No! Something went wrong! " + $error[0].Exception)
  61.                    exit 1;
  62.                    }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement