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
}
# put [BLANK] in variables
if (-not $Password) {$Password = '[BLANK]'}
if (-not $UserName) {$UserName = '[BLANK]'}
if (-not $Changed) {$Changed = '[BLANK]'}
if (-not $NewName) {$NewName = '[BLANK]'}
# Create custom object to output results
$ObjectProperties = @{'Passwords' = $Password;
'UserNames' = $UserName;
'Changed' = $Changed;
'NewName' = $NewName;
'File' = $File}
$ResultsObject = New-Object -TypeName PSObject -Property $ObjectProperties
Write-Verbose "The password is between {} and may be more than one value."
if ($ResultsObject) {Return $ResultsObject}
if ($Password -or $UserName -or $Changed -or $NewName) {
# put [BLANK] in variables
if (-not $Password) {$Password = '[BLANK]'}
if (-not $UserName) {$UserName = '[BLANK]'}
if (-not $Changed) {$Changed = '[BLANK]'}
if (-not $NewName) {$NewName = '[BLANK]'}
# Create custom object to output results
$ObjectProperties = @{'Passwords' = $Password;
'UserNames' = $UserName;
'Changed' = $Changed;
'NewName' = $NewName;
'File' = $File}
$ResultsObject = New-Object -TypeName PSObject -Property $ObjectProperties
Write-Verbose "The password is between {} and may be more than one value."
if ($ResultsObject) {Return $ResultsObject}
}
}
catch {Write-Error $Error[0]}