vmware / powershell-module-for-vmware-cloud-foundation-password-management

PowerShell Module for VMware Cloud Foundation Password Management
https://vmware.github.io/powershell-module-for-vmware-cloud-foundation-password-management/
BSD 2-Clause "Simplified" License
12 stars 9 forks source link

Enhance `Get-PasswordPolicyDefault` to show summary in human friendly manner #176

Closed sowjuec closed 8 months ago

sowjuec commented 8 months ago

Code of Conduct

Description

Execute the following.

Get-PasswordPolicyDefault -version '5.1.1.0'

you get following output.

vcf                : @{vcfVersion=5.1.1.0}
esxi               : @{passwordExpiration=; passwordComplexity=; accountLockout=}
sso                : @{passwordExpiration=; passwordComplexity=; accountLockout=}
vcenterServer      : @{passwordExpiration=}
vcenterServerLocal : @{passwordExpiration=; passwordComplexity=; accountLockout=}
nsxManager         : @{passwordExpiration=; passwordComplexity=; accountLockout=}
nsxEdge            : @{passwordExpiration=; passwordComplexity=; accountLockout=}
sddcManager        : @{passwordExpiration=; passwordComplexity=; accountLockout=}
wsaLocal           : @{passwordExpiration=; passwordComplexity=; accountLockout=}
wsaDirectory       : @{passwordExpiration=; passwordComplexity=; accountLockout=}

if you expand each object, you get output stored, for example,

PS C:\GitDownload\tests> (Get-PasswordPolicyDefault -version '5.1.1.0').esxi

passwordExpiration passwordComplexity                                              accountLockout
------------------ ------------------                                              --------------
@{maxDays=99999}   @{policy=retry=3 min=disabled,disabled,disabled,7,7; history=0} @{maxFailures=5; unlockInterval=900}

But summary shows nothing, users think that there is no output at all, but that is not true. So we need to enhance this to better display.

Use Case(s)

The command output is not showing the summary in a descriptive manner which is disguising the user to presume that there is no output

Potential Configuration

In the following code change the display to as shown below

    if ($PSBoundParameters.ContainsKey('generateJson')) {
        $defaultConfig | ConvertTo-Json -Depth 25 | Out-File -FilePath $jsonFile
        Write-Output "Generated JSON File ($jsonFile) with Product Password Policy Default Values"
    } else {
        $defaultConfig 
    }

Change $defaultConfig to $defaultConfig | ConvertTo-Json

References

No response

tenthirtyam commented 8 months ago

Great idea!

github-actions[bot] commented 7 months ago

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.