Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Removed overkill calls to Select-Object -ExpandProperty (#412)
Browse files Browse the repository at this point in the history
The script uses the . operator to access properties ($Secret.StartDateTime) except here:

$RemainingDaysCount = $EndDate - $Now |
            Select-Object -ExpandProperty Days

It is simpler to write
$RemainingDaysCount = ($EndDate - $Now).Days
  • Loading branch information
softwarepronto authored Sep 6, 2023
1 parent 7ad02ab commit 691d626
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions application-management/export-apps-with-expiring-secrets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ foreach ($App in $Applications) {
$Username = '<<No Owner>>'
}

$RemainingDaysCount = $EndDate - $Now |
Select-Object -ExpandProperty Days
$RemainingDaysCount = ($EndDate - $Now).Days

if ($IncludeAlreadyExpired -eq 'No') {
if ($RemainingDaysCount -le $DaysUntilExpiration -and $RemainingDaysCount -ge 0) {
Expand Down Expand Up @@ -150,8 +149,7 @@ foreach ($App in $Applications) {
$Username = '<<No Owner>>'
}

$RemainingDaysCount = $EndDate - $Now |
Select-Object -ExpandProperty Days
$RemainingDaysCount = ($EndDate - $Now).Days

if ($IncludeAlreadyExpired -eq 'No') {
if ($RemainingDaysCount -le $DaysUntilExpiration -and $RemainingDaysCount -ge 0) {
Expand Down

0 comments on commit 691d626

Please sign in to comment.