AsBuiltReport / AsBuiltReport.VMware.vSphere

Repository for AsBuiltReport VMware vSphere module
https://www.asbuiltreport.com
MIT License
112 stars 39 forks source link

Machine SSL certificate information not working using the vcenter IP address as -Target #98

Open rebelinux opened 2 years ago

rebelinux commented 2 years ago

https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere/blob/b4f5483791c338d4080963989700a91730b050d9/Src/Public/Invoke-AsBuiltReport.VMware.vSphere.ps1#L466

If the report is generated using the vcenter ip address as -Target the $_.Entity.Name is equal as the IP instead of the vcenter FQDN

PS /home/rebelinux> $VIMachineCertificates = Get-VIMachineCertificate -Server  192.168.5.2   
PS /home/rebelinux> $VIMachineCertificates 

Entity                         Subject                        Issuer                         NotValidAfter
------                         -------                        ------                         -------------
192.168.5.2                    vcenter-01v.pharmax.local      pharmax-SERVER-DC-01V-CA       1/25/2024 8:33:…
esxsvr-00f.pharmax.local       esxsvr-00f.pharmax.local       vcenter-01v                    5/21/2025 11:50…
comp-02a.pharmax.local         comp-02a.pharmax.local         vcenter-01v                    5/28/2026 8:35:…
comp-01a.pharmax.local         comp-01a.pharmax.local         vcenter-01v                    5/31/2026 11:45…

PS /home/rebelinux> $VIMachineCertificates.Entity.Name                                    
192.168.5.2
esxsvr-00f.pharmax.local
comp-02a.pharmax.local
comp-01a.pharmax.local
PS /home/rebelinux> 

Target as IP: Machine_Certificate_by_Vcenter_IP

Target as FQDN: Machine_Certificate_by_Vcenter_FQDN

Target as FQDN Report: Vcenter_Certificates

If a fix is not possible, it would be a good idea to update the documentation to state that the FQDN of the vcenter should be used.