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

Commit 691d626

Browse files
Removed overkill calls to Select-Object -ExpandProperty (#412)
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
1 parent 7ad02ab commit 691d626

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

application-management/export-apps-with-expiring-secrets.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ foreach ($App in $Applications) {
9595
$Username = '<<No Owner>>'
9696
}
9797

98-
$RemainingDaysCount = $EndDate - $Now |
99-
Select-Object -ExpandProperty Days
98+
$RemainingDaysCount = ($EndDate - $Now).Days
10099

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

153-
$RemainingDaysCount = $EndDate - $Now |
154-
Select-Object -ExpandProperty Days
152+
$RemainingDaysCount = ($EndDate - $Now).Days
155153

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

0 commit comments

Comments
 (0)