@@ -45,20 +45,20 @@ function Invoke-CIPPStandardAppManagementPolicy {
4545 }
4646
4747 # Unwrap autoComplete values - frontend sends {label, value} objects, extract the string
48- $passwordAdditionState = [string ]( $Settings.passwordCredentialsPasswordAddition.value ?? $Settings .passwordCredentialsPasswordAddition )
49- $customPasswordState = [string ]( $Settings.passwordCredentialsCustomPasswordAddition.value ?? $Settings .passwordCredentialsCustomPasswordAddition )
50- $passwordMaxLifetimeDays = $Settings.passwordCredentialsMaxLifetime.value ?? $Settings .passwordCredentialsMaxLifetime
51- $keyMaxLifetimeDays = $Settings.keyCredentialsMaxLifetime.value ?? $Settings .keyCredentialsMaxLifetime
48+ $passwordAdditionState = [string ]$Settings.passwordCredentialsPasswordAddition.value
49+ $customPasswordState = [string ]$Settings.passwordCredentialsCustomPasswordAddition.value
50+ $passwordMaxLifetimeDays = $Settings.passwordCredentialsMaxLifetime
51+ $keyMaxLifetimeDays = $Settings.keyCredentialsMaxLifetime
5252
5353 # Convert user-entered days to ISO 8601 duration format (P<n>D)
54- $passwordMaxLifetimeISO = if (-not [string ]::IsNullOrWhiteSpace($passwordMaxLifetimeDays ) -and $passwordMaxLifetimeDays -ne ' Select a value ' ) { " P${passwordMaxLifetimeDays} D" } else { $null }
55- $keyMaxLifetimeISO = if (-not [string ]::IsNullOrWhiteSpace($keyMaxLifetimeDays ) -and $keyMaxLifetimeDays -ne ' Select a value ' ) { " P${keyMaxLifetimeDays} D" } else { $null }
54+ $passwordMaxLifetimeISO = if (-not [string ]::IsNullOrWhiteSpace($passwordMaxLifetimeDays )) { " P${passwordMaxLifetimeDays} D" } else { $null }
55+ $keyMaxLifetimeISO = if (-not [string ]::IsNullOrWhiteSpace($keyMaxLifetimeDays )) { " P${keyMaxLifetimeDays} D" } else { $null }
5656
5757 # Build desired password credential restrictions
5858 $desiredPasswordCredentials = [System.Collections.Generic.List [object ]]::new()
5959
6060 # Password addition + symmetric key addition (mirrors password addition)
61- if (-not [string ]::IsNullOrWhiteSpace($passwordAdditionState ) -and $passwordAdditionState -ne ' Select a value ' ) {
61+ if (-not [string ]::IsNullOrWhiteSpace($passwordAdditionState )) {
6262 $desiredPasswordCredentials.Add ([ordered ]@ {
6363 restrictionType = ' passwordAddition'
6464 state = $passwordAdditionState
@@ -74,7 +74,7 @@ function Invoke-CIPPStandardAppManagementPolicy {
7474 }
7575
7676 # Custom password
77- if (-not [string ]::IsNullOrWhiteSpace($customPasswordState ) -and $customPasswordState -ne ' Select a value ' ) {
77+ if (-not [string ]::IsNullOrWhiteSpace($customPasswordState )) {
7878 $desiredPasswordCredentials.Add ([ordered ]@ {
7979 restrictionType = ' customPasswordAddition'
8080 state = $customPasswordState
0 commit comments