Skip to content

Commit

Permalink
feat: add check for cmdlet prerequisites
Browse files Browse the repository at this point in the history
Added a prerequisite check to `Invoke-VcfHealthReport` function to verify that the tar utility is present on Windows if using Windows PowerShell 5.1 (Desktop) or PowerShell 7 (Core).

The `tar` utility is included with Windows Server 2019 and later and is noted as a system requirement in the documentation.

Signed-off-by: Jared Burns <burnsja@vmware.com>
  • Loading branch information
burnsjared0415 authored and tenthirtyam committed Nov 16, 2023
1 parent 0899c29 commit f398e16
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History

## v2.5.0

> Release Date: Unreleased
Enhancement:

- Added a prerequisite check to `Invoke-VcfHealthReport` function to verify that the tar utility is present on Windows if using Windows PowerShell 5.1 (Desktop) or PowerShell 7 (Core). The `tar` utility is included with Windows Server 2019 and later and is noted as a system requirement in the documentation. [GH-191](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/191)

## v2.4.2

> Release Date: 2023-10-18
Expand Down
4 changes: 2 additions & 2 deletions VMware.CloudFoundation.Reporting.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: VMware, Inc.
#
# Generated on: 2023-10-18
# Generated on: 2023-11-16
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = '.\VMware.CloudFoundation.Reporting.psm1'

# Version number of this module.
ModuleVersion = '2.4.2.1000'
ModuleVersion = '2.5.0.1000'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
8 changes: 8 additions & 0 deletions VMware.CloudFoundation.Reporting.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ Function Invoke-VcfHealthReport {

Try {
Clear-Host; Write-Host ""

if ($PSVersionTable.PSEdition -eq "Desktop" -or $PSVersionTable.OS -like "Microsoft Windows*") {
$tarPath = (Get-Command tar -ErrorAction SilentlyContinue).Source
if (!($tarPath)) {
Write-Warning "The tar utility is required to run this cmdlet. Please check the module system requirements and try again."
return
}
}

if (Test-VCFConnection -server $sddcManagerFqdn) {
if (Test-VCFAuthentication -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass) {
Expand Down

0 comments on commit f398e16

Please sign in to comment.