Skip to content

Commit

Permalink
get usernames if calling -UserCerts as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Dec 6, 2024
1 parent 6b02e33 commit 60ec543
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ function Get-CertInfo {
}
# lastly add the username of the certificate to the hash:
$certFile = Get-Item $($cert.Path)
# $username = $certFile.name.split('-')[0]
if ('username' -notin $MyInvocation.BoundParameters) {
$matchNames = $certFile.name | Select-String -Pattern "(.*)-$($Global:JCR_CERT_TYPE).*"
$username = $matchNames.Matches.groups[1].value
}

$certHash | Add-Member -Name 'username' -Type NoteProperty -Value $username
$certHash | Add-Member -Name 'generated' -Type NoteProperty -Value ($certFile.LastWriteTime.ToString('MM/dd/yyyy HH:mm:ss'))
# Add hash to certObj array if the user is a member of the userGroup
Expand Down

0 comments on commit 60ec543

Please sign in to comment.