From 81d2cd24fdec9711c8d7e15cf32e8032b53736b2 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Tue, 11 Apr 2023 14:40:04 -0400 Subject: [PATCH] refactor: update `Invoke-VcfReportingPrereq` cmdlet - **Breaking**: Updates `Invoke-VcfReportingPrereq` to: - Use the `-sddcManagerFqdn`, `sddcManagerUser`, and `sddcManagerPass` parameters to check the SDDC Manager version. - Use the `Write-LogMessage` to apply colors to the output and log the output to a file using the `-logPath` parameter. - Updates `PowerValidatedSolutions` from v2.0.1 to v2.2.0. - Updates `VMware.PowerCLI` from v12.7.0 to v13.0.0. - Updates `VMware.vSphere.SsoAdmin` from v1.3.8 to v1.3.9. Closes #115 Signed-off-by: Ryan Johnson --- CHANGELOG.md | 15 +++++++ VMware.CloudFoundation.Reporting.psd1 | 4 +- VMware.CloudFoundation.Reporting.psm1 | 57 ++++++++++++++++++++------- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ab0943..ed312b0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,17 @@ > Release Date: Unreleased Enhancement: + - Updates `Publish-CertificateHealth` with thresholds based on certificate expiration. [GH-107](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/107) - Updates `Publish-CertificateHealth` to include an "Expires In (Days)" column. [GH-107](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/107) - Updates `Publish-CertificateHealth` to include ESXi host certificates. [GH-107](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/107) - Updates `Publish-PasswordHealth` to include an "Expires In (Days)" column. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) Refactor: + +- **Breaking**: Updates `Invoke-VcfReportingPrereq` to: + - Use the `-sddcManagerFqdn`, `sddcManagerUser`, and `sddcManagerPass` parameters to check the SDDC Manager version. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) + - Use the `Write-LogMessage` to apply colors to the output and log the output to a file using the `-logPath` parameter. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) - **Breaking**: Updates `Invoke-VcfHealthReport` to use `-localUser` and `localPass` parameters instead of `-SddcManagerRootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) - **Breaking**: Updates `Publish-StorageCapacityHealth` to use `-localUser` and `localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) - **Breaking**: Updates `Request-SddcManagerStorageHealth` to use `-localUser` and `localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) @@ -19,17 +24,25 @@ Refactor: - Updates `Invoke-VcfHealthReport` to use the `Publish-PasswordHealth` cmdlet. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) - Removes `Publish-LocalUserExpiry` in favor of the `Publish-PasswordHealth` cmdlet. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) +Chore: + +- Updates `PowerValidatedSolutions` from v2.0.1 to v2.2.0. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) +- Updates `VMware.PowerCLI` from v12.7.0 to v13.0.0. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) +- Updates `VMware.vSphere.SsoAdmin` from v1.3.8 to v1.3.9. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) + ## [v1.1.0](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/releases/tag/v1.1.0) > Release Date: 2023-02-28 Bugfix: + - Updates `Request-VcenterBackupStatus` backup message to remove the SDDC Manager FQDN when backups are located on the SDDC Manager. Required for Heatlh Monitoring and Reporting solution alerts. [GH-95](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/95) - Updates `Publish-vCenerHealth` to correctly link and display the vCenter Server Ring Topology Health from SoS. [GH-94](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/94) - Resolves an issue with the display name of the vRealize Log Insight product name in the `Request-VrealizeOverview`due to an upstream error in the `.SYNOPSIS` of `Get-VCFvRLI` in `PowerVCF`. [GH-86](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/86) - Updates `Test-VcfReportingPrereq` to return results when run on Photon OS. [GH-82](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/82) Enhancement: + - Updates `Publish-*` cmdlets to support JSON generation. Required for Heatlh Monitoring and Reporting solution. [GH-79](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/79) - `Publish-BackupStatus` - `Publish-NsxtTransportNodeStatus` @@ -43,10 +56,12 @@ Enhancement: - Adds an option to `Request-ESXiOverview` to report on the VCF+ subscription cores and export the results to CSV. [GH-87](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/87) Documenation: + - Updates `README.md` to remove the **Known Issues** section and adds references to the GitHub issue tracker for support. [GH-88](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/88) - Updates `README.md` documentation to include support for DellEMC VxRAIL. [GH-98](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/98) Chore: + - Removes the password policy functions that were moved to `PowerValidatedSolutions` v2.0.0. [GH-100](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/100) - Updates `PowerValidatedSolutions` from v2.0.0 to v2.0.1. [GH-99](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/99) diff --git a/VMware.CloudFoundation.Reporting.psd1 b/VMware.CloudFoundation.Reporting.psd1 index 64b9b672..537873c7 100644 --- a/VMware.CloudFoundation.Reporting.psd1 +++ b/VMware.CloudFoundation.Reporting.psd1 @@ -3,7 +3,7 @@ # # Generated by: Gary Blake, Cloud Infrastructure Business Group (CIBG) # -# Generated on: 03/28/2023 +# Generated on: 04/25/2023 # @{ @@ -12,7 +12,7 @@ RootModule = '.\VMware.CloudFoundation.Reporting.psm1' # Version number of this module. - ModuleVersion = '2.0.0.1005' + ModuleVersion = '2.0.0.1006' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/VMware.CloudFoundation.Reporting.psm1 b/VMware.CloudFoundation.Reporting.psm1 index 923106c0..9d41e71d 100644 --- a/VMware.CloudFoundation.Reporting.psm1 +++ b/VMware.CloudFoundation.Reporting.psm1 @@ -8072,28 +8072,57 @@ Function Test-VcfReportingPrereq { The Test-VcfReportingPrereq cmdlet checks that all the prerequisites have been met to run the PowerShell module. .EXAMPLE - Test-VcfReportingPrereq + Test-VcfReportingPrereq -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser admin@local -sddcManagerPass VMw@re1!VMw@re1! -logPath F:\Reporting This example runs the prerequisite validation. #> + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$logPath + ) + Try { + Clear-Host; Write-Host "" + + $vcfMinVersion = "4.4.0" + $modules = @( - @{ Name=("VMware.PowerCLI"); Version=("12.7.0")} - @{ Name=("VMware.vSphere.SsoAdmin"); Version=("1.3.8")} - @{ Name=("PowerVCF"); Version=("2.2.0")} - @{ Name=("PowerValidatedSolutions"); Version=("2.0.1")} + @{ Name=("VMware.PowerCLI"); MinimumVersion=("13.0.0")} + @{ Name=("VMware.vSphere.SsoAdmin"); MinimumVersion=("1.3.9")} + @{ Name=("PowerVCF"); MinimumVersion=("2.2.0")} + @{ Name=("PowerValidatedSolutions"); MinimumVersion=("2.2.0")} ) - foreach ($module in $modules ) { - if ((Get-InstalledModule -Name $module.Name).Version -lt $module.Version) { - $message = "PowerShell Module: $($module.Name) Version: $($module.Version) Not Installed, Please update before proceeding." - Write-Warning $message; Write-Host "" - break - } else { - $moduleCurrentVersion = (Get-InstalledModule -Name $module.Name).Version - $message = "PowerShell Module: $($module.Name) Version: $($moduleCurrentVersion) Found, Supports the minimum required version." - $message + + if (Test-VCFConnection -server $sddcManagerFqdn) { + if (Test-VCFAuthentication -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass) { + Start-SetupLogFile -Path $logPath -ScriptName $MyInvocation.MyCommand.Name # Setup Log Location and Log File + + $vcfVersion = ((Get-VCFManager).version).Split('-')[0] + if ($vcfVersion -lt $vcfMinVersion) { + $message = "VMware Cloud Foundation: SDDC Manager $vcfVersion ($($sddcManagerFqdn)) is not supported by this module. Minimum required version is $($vcfMinVersion)." + Write-LogMessage -Type ERROR -Message $message -Colour Red + Break + } else { + $message = "VMware Cloud Foundation: SDDC Manager $vcfVersion ($($sddcManagerFqdn)) and supports the minimum required version." + Write-LogMessage -Type INFO -Message $message -Colour Green + } + + foreach ($module in $modules ) { + if ((Get-InstalledModule -ErrorAction SilentlyContinue -Name $module.Name).Version -lt $module.MinimumVersion) { + $message = "PowerShell Module: $($module.Name) $($module.MinimumVersion) is not installed." + Write-LogMessage -Type ERROR -Message $message -Colour Red + Break + } else { + $moduleCurrentVersion = (Get-InstalledModule -Name $module.Name).Version + $message = "PowerShell Module: $($module.Name) $($moduleCurrentVersion) is installed and supports the minimum required version." + Write-LogMessage -Type INFO -Message $message -Colour Green + } + } } } + } Catch { Write-Error $_.Exception.Message