VMware Cloud Community
peter79
Enthusiast
Enthusiast
Jump to solution

Script to find all Dell servers in my enviroment

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.

Reply
0 Kudos
1 Solution

Accepted Solutions
Zsoldier
Expert
Expert
Jump to solution

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

Reply
0 Kudos
8 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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
peter79
Enthusiast
Enthusiast
Jump to solution

Robert,

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

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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
Reply
0 Kudos
Zsoldier
Expert
Expert
Jump to solution

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
aevrov
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
peter79
Enthusiast
Enthusiast
Jump to solution

Angel,

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

Reply
0 Kudos
aevrov
VMware Employee
VMware Employee
Jump to solution

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...

Reply
0 Kudos
Zsoldier
Expert
Expert
Jump to solution

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
Reply
0 Kudos