Highlighted
Hot Shot
Hot Shot

Get All information regarding ESXi Firmware Driver installed VIB

Hello

I'm looking for a script that can allow me to get all the below details from differentes hosts managed by differentes vCenter

Firmware

Drivers

ESXi version

installed VIB

Patches

Any idea? help?

54 Replies
Highlighted
User Moderator
User Moderator

How do you plan on combining that data?

There will be a lot of redundant data if you at one report.

Can this be multiple files (CSV) or a single file (HTML)?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

Best option is to have the date in html file in order to track changes

the ENV; is very huge and the only way to get all details centralized is to have one single file

0 Kudos
Highlighted
User Moderator
User Moderator

I forgot to mention one option, an XLSX file with multiple worksheets (with the ImportExcel module).
This would make the data more accessible for other scripts (vs a HTML file).
Would that be an option for you?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Hot Shot
Hot Shot

then should be fine Smiley Happy

and thanks in advance for your help

0 Kudos
Highlighted
User Moderator
User Moderator

Let us start with this version, it gives the VIB info and the Patch info in 2 separate worksheets in the XLSX file.

Note: the script assumes you are connected to all vCenters when you run it.

#Requires Modules ImportExcel

$fileName = '.\report.xlsx'


$reportVIB = @()

$reportPatch = @()


$global:DefaultVIServers |

ForEach-Object -Process {

    Get-VMHost -Server $_ -PipelineVariable esx |

    ForEach-Object -Process {

        $esxcli = Get-EsxCli -VMHost $esx -V2

        $reportVIB += $esxcli.software.vib.list.Invoke() |

        Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            Name,ID,CreationDate,InstallDate,Version,Vendor,AcceptanceLevel


        Get-Compliance -Entity $esx -Detailed -PipelineVariable baseline |

        where{$_ -is [VMware.VumAutomation.Types.PatchBaselineCompliance]} |

        ForEach-Object -Process {

            $reportPatch += $baseline.CompliantPatches |

            Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            @{N='Baseline';E={$baseline.Baseline.Name}},

            @{N='Compliant';E={$true}},

            Name,Vendor,IdByVendor,ReleaseDate,LastUpdateTime,Severity,@{N='Product';E={$_.Product.Name}}


            $reportPatch += $baseline.NotCompliantPatches |

            Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            @{N='Baseline';E={$baseline.Baseline.Name}},

            @{N='Compliant';E={$false}},

            Name,Vendor,IdByVendor,ReleaseDate,LastUpdateTime,Severity,@{N='Product';E={$_.Product.Name}}

        }

    }

}


$reportVIB | Export-Excel -Path $fileName -WorksheetName 'VIB'

$reportPatch | Export-Excel -Path $fileName -WorksheetName 'Patch'


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Hot Shot
Hot Shot

Thanks LucD

I will do some tests and keep uou posted Smiley Happy

0 Kudos
Highlighted
User Moderator
User Moderator

Let me know if you need other info. We can add as many worksheets as we want (in theory).


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

tried to do test, unfortunately I got the below message

WARNING: There were one or more problems with the Update Manager Server certificate:

* The X509 chain could not be built up to the root certificate.

Export-Excel : The term 'Export-Excel' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At .\VIB_Firmware_Drivers_Details.ps1:75 char:14

+ $reportVIB | Export-Excel -Path $fileName -WorksheetName 'VIB'

+              ~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Export-Excel:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

Export-Excel : The term 'Export-Excel' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At .\VIB_Firmware_Drivers_Details.ps1:77 char:16

+ $reportPatch | Export-Excel -Path $fileName -WorksheetName 'Patch'

+                ~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Export-Excel:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

by the way #Requires Modules ImportExcel is mentionned as a comment shall I remove #?

0 Kudos
Highlighted
User Moderator
User Moderator

No that is not a comment, the #requires line states that the module is required, if it is not there the script will not run.

You don't seem to have the ImportExcel module installed.

The Update Manager in your environment doesn't seem to be using a valid certificate.
But that seems to be a warning.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Hot Shot
Hot Shot

Ok let me check and keep you posted

0 Kudos
Highlighted
Hot Shot
Hot Shot

yep you are rightthe module is missing

The script 'VIB_Firmware_Drivers_Details.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are

missing: ImportExcel.

    + CategoryInfo          : ResourceUnavailable: (VIB_Firmware_Drivers_Details.ps1:String) [], ParentContainsErrorRecordException

    + FullyQualifiedErrorId : ScriptRequiresMissingModules

$PSVersionTable.PSVersion

Major  Minor  Build  Revision

-----  -----  -----  --------

5      0      10586  117    

not sure how I can import it as the internet connectivity is not allowed....

0 Kudos
Highlighted
User Moderator
User Moderator

You can use the Save-Module, provided you have a station somewhere that has Internet access.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

the omportExcel Module is imported unfortunatly I got the below output:

PS C:\path> .\VIB_Firmware_Drivers_Details.ps1

At C:\path\VIB_Firmware_Drivers_Details.ps1:15 char:22

+ "#Requires –Modules" ImportExcel

+                      ~~~~~~~~~~~~~

The string is missing the terminator: ".

At .\VIB_Firmware_Drivers_Details.ps1:15 char:15

+ "#Requires –Modules" ImportExcel

+               ~~~~~~~~~~~~~~~~~~~~

Unexpected token 'Modules" ImportExcel

$fileName = '.\VIB_Firmware_Driver_Details\report.xlsx'

$reportVIB = @()

$reportPatch = @()

$global:DefaultVIServers |

ForEach-Object -Process {

    Get-VMHost -Server $_ -PipelineVariable esx |

    ForEach-Object -Process {

        $esxcli = Get-EsxCli -VMHost $esx -V2

        $reportVIB += $esxcli.software.vib.list.Invoke() |

        Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            Name,ID,CreationDate,InstallDate,Version,Vendor,AcceptanceLevel

        Get-Compliance -Entity $esx -Detailed -PipelineVariable baseline |

        where{$_ -is [VMware.VumAutomation.Types.PatchBaselineCompliance]} |

        ForEach-Object -Process {

            $reportPatch += $baseline.CompliantPatches |

            Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            @{N='Baseline';E={$baseline.Baseline.Name}},

            @{N='Compliant';E={$true}},

            Name,Vendor,IdByVendor,ReleaseDate,LastUpdateTime,Severity,@{N='Product';E={$_.Product.Name}}

            $reportPatch += $baseline.NotCompliantPatches |

            Select @{N='vCenter';E={([uri]$esx.ExtensionData.Client.ServiceUrl).Host}},

            @{N='VMHost';E={$esx.Name}},

            @{N='Baseline';E={$baseline.Baseline.Name}},

            @{N='Compliant';E={$false}},

            Name,Vendor,IdByVendor,ReleaseDate,LastUpdateTime,Severity,@{N='Product';E={$_.Product.Name}}

        }

    }

}

$reportVIB | Export-Excel -Path $fileName -WorksheetName 'VIB'

$reportPatch | Export-Excel -Path $fileName -WorksheetName 'Patch'' in expression or statement.

    + CategoryInfo          : ParserError: (:) [], ParseException

    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

0 Kudos
Highlighted
User Moderator
User Moderator

There seem to be some funny characters on this line


#Requires –Modules" ImportExcel

That should be

#Requires "Modules" ImportExcel


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

not sure what happend, change done and below the output:

At C:\path\VIB_Firmware_Drivers_Details.ps1:15 char:11

+ #Requires "Modules" ImportExcel

+           ~~~~~~~~~

Cannot process the #requires statement because it is not in the correct format.

The #requires statement must be in one of the following formats:

"#requires -shellid <shellID>"

"#requires -version <major.minor>"

"#requires -psedition <edition>"

"#requires -pssnapin <psSnapInName> [-version <major.minor>]"

"#requires -modules <ModuleSpecification>"

"#requires -runasadministrator"

At C:\path\VIB_Firmware_Drivers_Details.ps1:15 char:21

+ #Requires "Modules" ImportExcel

+                     ~~~~~~~~~~~

Cannot process the #requires statement because it is not in the correct format.

The #requires statement must be in one of the following formats:

"#requires -shellid <shellID>"

"#requires -version <major.minor>"

"#requires -psedition <edition>"

"#requires -pssnapin <psSnapInName> [-version <major.minor>]"

"#requires -modules <ModuleSpecification>"

"#requires -runasadministrator"

    + CategoryInfo          : ParserError: (:) [], ParseException

    + FullyQualifiedErrorId : ScriptRequiresInvalidFormat

0 Kudos
Highlighted
User Moderator
User Moderator

Sorry, my bad, that line should be

#Requires -Modules ImportExcel


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

Geat it's working fine now Smiley Happy

for patch I don't have any data, means that the ESXi never patched, right?

it's possible to add firmware information?

Any useful information that you can suggest Smiley Happy

0 Kudos
Highlighted
Hot Shot
Hot Shot

for example adding the Version, Build for esxi and vcenter should be also useful info that can be added to this script

0 Kudos
Highlighted
User Moderator
User Moderator

If there are no patches applied to the ESXi node and the ESXi node has a Baseline attached, you should see that the node is non-compliant and the missing patches.


Where do you want that build and version?

On both worksheets?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos