Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSFT_xExchImapSettings,MSFT_xExchPopSettings ExternalConnectionSettings can be $null #461

Open
jrdbarnes opened this issue Oct 14, 2020 · 0 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@jrdbarnes
Copy link

jrdbarnes commented Oct 14, 2020

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

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants