Skip to content

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

Closed
@sowjuec

Description

@sowjuec

Code of Conduct

  • I have read and agree to the project's Code of Conduct.
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions