Servers - General
1833875 Members
1639 Online
110063 Solutions
New Discussion

Query: how can I learn server serial number and the local disk serial number with PowerShell?

 
_Alper_
Occasional Contributor

how can I learn server serial number and the local disk serial number with PowerShell?

Is there a powershell command that will allow me to see both the server serial number and the disk serial number at the same time on the hp dl380 Gen10-11 server? It seems very difficult to do this one by one from the ilo interface on about 950 servers. I was only able to get the disk serial numbers with the command below. I need both the disk and server serial numbers to create an inventory.

$appliances = 'oneview'

$reportUsername = '*********'

$reportPassword = '***********'

$filePath = "C:\report\Scheduled_Reports\OneView_Reports\"

Connect-OVMgmt -Hostname $appliances -AuthLoginDomain Local -UserName $reportUsername -Password $reportPassword

Get-OVServer

(Get-OVServer | Select-Object -First 10000 | % { sr -uri ($_.uri + '/localStorage')

 }).Data

(Get-OVServer | Select-Object -First 10000 | % { sr -uri ($_.uri + '/localStorageV2')

 }).Data

  $exportPath = @{

   serverInventory = $filePath + "Server_Inventory\" + $reportName.serverInventory + $fileDate + ".csv";

 }  

 

2 REPLIES 2
Rama2
HPE Pro

Re: how can I learn server serial number and the local disk serial number with PowerShell?

Kindly try the below script and see if it fetches the info
curl --insecure \
     --header "auth: ${sessionID}" \
     --header "X-API-Version: ${currentVersion}" \
     --request GET ${OneView}/rest/server-hardware?filter=%22%27serverName%27%20=%20%27my-host%27%22 | jq -r '.'



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
support_s
System Recommended

Query: how can I learn server serial number and the local disk serial number with PowerShell?

Hello,

 

Let us know if you were able to resolve the issue.

 

If you have no further query, and you are satisfied with the answer then kindly mark the topic as Solved so that it is helpful for all community members.

 

Please click on "Thumbs Up/Kudo" icon to give a "Kudo".

 

Thank you for being a HPE valuable community member.


Accept or Kudo