Highlighted
Enthusiast
Enthusiast

Script to find all Dell servers in my enviroment

Jump to solution

Guys,

I'm looking for a script to find all Dell hosts in my enviroment and if possible the current BIOS version.  I would also like to output the results to an excel spreadsheet.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Expert
Expert

I made a script to find the BIO's info on Dell's.  I had a mix of 6850's, R710's, R810's, and R900's.

$ESXServers = Get-VMHost
$ESXInfo = @()
Foreach ($ESX in $ESXServers){
$NewObj           = "" | Select Name, Model, Manufacturer,  BIOs
$NewObj.Name     = $ESX.Name
$NewObj.Model     = $ESX.Model
$NewObj.Manufacturer = $ESX.Manufacturer
$NewObj.BIOs     = (($ESX.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | where {$_.Name -like "*BIOS*"  -and $_.SensorType -eq "Software Components"}).Name) -replace(".* BIOS ","") -replace(" .*","")
$ESXInfo += $NewObj
}
$ESXInfo
Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

0 Kudos
8 Replies
Highlighted
User Moderator
User Moderator

Hi Peter,

you can get all the Dell hosts and their Bios version with:

Get-VMHost | `
  Where-Object {$_.Manufacturer -eq "Dell"} | `
  Select-Object -Property Name,Manufacturer,@{N="BiosVersion";E={$_.ExtensionData.Hardware.BiosInfo.BiosVersion}} | `
  Sort-Object -Property Name | `
  Export-Csv -NoTypeInformation -UseCulture -Path DellHosts.csv


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Highlighted
Enthusiast
Enthusiast

Robert,

Thanks for your reply.  While the script did execute without errors and it did create the csv file, the file itseldf was empty.

0 Kudos
Highlighted
User Moderator
User Moderator

Hi Peter,

I have only HP servers. So I don't know exactly what the Manufacturer property of a Dell ESX server looks like. Maybe you can find out with

Get-VMHost | Select-Object -Property Name,Manufacturer

and change the script accordingly?

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
Highlighted
Expert
Expert

Robert has the right idea, I'd suggest changing the '-eq' to -'match' though.  Dell tends to have a different entry depending on the generation of server for manufacturer.

Get-VMHost | `
  Where-Object {$_.Manufacturer -match "Dell"} | `
  Select-Object -Property Name,Manufacturer,@{N="BiosVersion";E={$_.ExtensionData.Hardware.BiosInfo.BiosVersion}} | `
  Sort-Object -Property Name | `
  Export-Csv -NoTypeInformation -UseCulture -Path DellHosts.csv
Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Highlighted
VMware Employee
VMware Employee

Hi peter79,

The file is empty because the Where-Object filter shhould be tweaked a little bit.

You should replace this:

{$_.Manufacturer -eq"Dell"}

with this:

{$_.Manufacturer -like "*Dell*"}

The -eq doesn't give you what you expect because it returns only the "dell" string whereas the -like and stars around the string return any string that contains the word "dell" ("Dell Inc." for example).

Regards,

-Angel

0 Kudos
Highlighted
Enthusiast
Enthusiast

Angel,

Thanks for that tweak.  The CSV file is now filling up however it still isnt picking up the BIOS version.

0 Kudos
Highlighted
VMware Employee
VMware Employee

Well, it's the same in my environment too. By some reason the VI Api doesn't return the Bios information of the hosts.. Unfortunatly, I cannot think of another way to get it right now...

0 Kudos
Highlighted
Expert
Expert

I made a script to find the BIO's info on Dell's.  I had a mix of 6850's, R710's, R810's, and R900's.

$ESXServers = Get-VMHost
$ESXInfo = @()
Foreach ($ESX in $ESXServers){
$NewObj           = "" | Select Name, Model, Manufacturer,  BIOs
$NewObj.Name     = $ESX.Name
$NewObj.Model     = $ESX.Model
$NewObj.Manufacturer = $ESX.Manufacturer
$NewObj.BIOs     = (($ESX.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | where {$_.Name -like "*BIOS*"  -and $_.SensorType -eq "Software Components"}).Name) -replace(".* BIOS ","") -replace(" .*","")
$ESXInfo += $NewObj
}
$ESXInfo
Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

0 Kudos