local:Get-GPPInnerFields - Only output a result if one of Password, Username, Changed or NewName is not blank.

This commit is contained in:
Michael Koehler 2017-09-29 22:12:15 -04:00
parent 173ba5c9e0
commit 198d9f78dd
1 changed files with 18 additions and 16 deletions

View File

@ -3681,22 +3681,24 @@ function Get-CachedGPPPassword {
$Password += , $DecryptedPassword $Password += , $DecryptedPassword
} }
# put [BLANK] in variables if ($Password -or $UserName -or $Changed -or $NewName) {
if (-not $Password) {$Password = '[BLANK]'} # put [BLANK] in variables
if (-not $UserName) {$UserName = '[BLANK]'} if (-not $Password) {$Password = '[BLANK]'}
if (-not $Changed) {$Changed = '[BLANK]'} if (-not $UserName) {$UserName = '[BLANK]'}
if (-not $NewName) {$NewName = '[BLANK]'} if (-not $Changed) {$Changed = '[BLANK]'}
if (-not $NewName) {$NewName = '[BLANK]'}
# Create custom object to output results # Create custom object to output results
$ObjectProperties = @{'Passwords' = $Password; $ObjectProperties = @{'Passwords' = $Password;
'UserNames' = $UserName; 'UserNames' = $UserName;
'Changed' = $Changed; 'Changed' = $Changed;
'NewName' = $NewName; 'NewName' = $NewName;
'File' = $File} 'File' = $File}
$ResultsObject = New-Object -TypeName PSObject -Property $ObjectProperties $ResultsObject = New-Object -TypeName PSObject -Property $ObjectProperties
Write-Verbose "The password is between {} and may be more than one value." Write-Verbose "The password is between {} and may be more than one value."
if ($ResultsObject) {Return $ResultsObject} if ($ResultsObject) {Return $ResultsObject}
}
} }
catch {Write-Error $Error[0]} catch {Write-Error $Error[0]}