MSFT_xExchImapSettings,MSFT_xExchPopSettings ExternalConnectionSettings can be $null
jrdbarnes opened this issue · 0 comments
Details of the scenario you tried and the problem that is occurring
It is a valid configuration option to set ExternalConnectionSettings =$null in Set-PopSettings or Set-IMAPSettings.
The above DSC resources have ExternalConnectionSettings with explicit typing as Strings. I was able to pass empty strings, but maybe they should also be decorated with [AllowEmptyString()]
The Empty Strings are passed directly to Set-PopSettings or Set-IMAPSettings which rejects them as empty strings, but would allow $null. There is already a helper available to do this conversion which is is used in the test
Verbose logs showing the problem
Suggested solution to the issue
Adding
Set-EmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters
to
https://github.com/dsccommunity/xExchange/blob/3277f2aa8a4a7472fc8610507deecfec54413b29/source/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1#L105
https://github.com/dsccommunity/xExchange/blob/3277f2aa8a4a7472fc8610507deecfec54413b29/source/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1#L681
The DSC configuration that is used to reproduce the issue (as detailed as possible)
$invokeParams = @{
name = 'xExchImapSettings',
module = @{
modulename = 'xExchange',
moduleversion = '1.27.0.0'
},
Method = 'set'
properties = @{
'server' = 'servername',
'allowServiceRestart' = $false,
'loginType' = 'PlaintextLogin',
'externalConnectionSettings' = @(""),
'credential' = $exchangecredential,
}
}
Invoke-DscResource @InvokeParams
$invokeParams = @{
name = 'xExchPopSettings',
module = @{
modulename = 'xExchange',
moduleversion = '1.27.0.0'
},
properties => {
'server' = 'servername',
'allowServiceRestart' = $false,
'loginType' = 'PlaintextLogin',
'externalConnectionSettings' = @(""),
'credential' = $exchangecredential,
}
}
Invoke-DscResource @InvokeParams
Exchange Server edition and version the target node is running
Exchange Server 2019 CU 4
The operating system the target node is running
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.17763.1432
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1432
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
Name Version Path
xExchange 1.27.0.0 C:\Program Files\WindowsPowerShell\Modules\xExchange\1.27.0.0\xExchange.psd1