diff --git a/source/DSCResources/DSC_CMSiteConfiguration/DSC_CMSiteConfiguration.psm1 b/source/DSCResources/DSC_CMSiteConfiguration/DSC_CMSiteConfiguration.psm1 index 475b743..6150151 100644 --- a/source/DSCResources/DSC_CMSiteConfiguration/DSC_CMSiteConfiguration.psm1 +++ b/source/DSCResources/DSC_CMSiteConfiguration/DSC_CMSiteConfiguration.psm1 @@ -135,14 +135,15 @@ function Get-TargetResource { switch ($item.PropertyName) { - 'Certificate Store' { if ([string]::IsNullOrEmpty($item.Value1)) - { + 'Certificate Store' { + if ([string]::IsNullOrEmpty($item.Value1)) + { $customStore = 'Personal' - } - else - { + } + else + { $customStore = $item.Value1 - } + } } 'Select First Certificate' { $certSel = @('FailSelectionAndSendErrorMessage','SelectCertificateWithLongestValidityPeriod')[($item.Value)] } @@ -617,9 +618,11 @@ function Set-TargetResource if ($state.SiteType -eq 'Primary') { - $defaultValues += @('ClientCheckCertificateRevocationListForSiteSystem','UsePkiClientCertificate', - 'RequireSigning','UseEncryption','EnableLowFreeSpaceAlert','EnableWakeOnLan','ClientCertificateCustomStoreName', - 'TakeActionForMultipleCertificateMatchCriteria','ClientCertificateSelectionCriteriaType','ClientComputerCommunicationType') + $defaultValues += @( + 'ClientCheckCertificateRevocationListForSiteSystem','UsePkiClientCertificate','RequireSigning','UseEncryption', + 'EnableLowFreeSpaceAlert','EnableWakeOnLan','ClientCertificateCustomStoreName','TakeActionForMultipleCertificateMatchCriteria', + 'ClientCertificateSelectionCriteriaType','ClientComputerCommunicationType' + ) if (($PSBoundParameters.ContainsKey('UseSmsGeneratedCert')) -and (-not [string]::IsNullOrEmpty($ClientComputerCommunicationType) -and $ClientComputerCommunicationType -eq 'HttpsOnly') -or @@ -664,9 +667,11 @@ function Set-TargetResource } } - $wolParams = @('WakeOnLanTransmissionMethodType','RetryNumberOfSendingWakeupPacketTransmission','SendingWakeupPacketTransmissionDelayMins', - 'MaximumNumberOfSendingWakeupPacketBeforePausing','SendingWakeupPacketBeforePausingWaitSec','ThreadNumberOfSendingWakeupPacket', - 'SendingWakeupPacketTransmissionOffsetMins') + $wolParams = @( + 'WakeOnLanTransmissionMethodType','RetryNumberOfSendingWakeupPacketTransmission','SendingWakeupPacketTransmissionDelayMins', + 'MaximumNumberOfSendingWakeupPacketBeforePausing','SendingWakeupPacketBeforePausingWaitSec','ThreadNumberOfSendingWakeupPacket', + 'SendingWakeupPacketTransmissionOffsetMins' + ) foreach ($param in $wolParams) { @@ -1096,9 +1101,11 @@ function Test-TargetResource if ($state.SiteType -eq 'Primary') { - $defaultValues += @('ClientCheckCertificateRevocationListForSiteSystem','UsePkiClientCertificate', - 'RequireSigning','UseEncryption','EnableLowFreeSpaceAlert','EnableWakeOnLan','ClientCertificateCustomStoreName', - 'TakeActionForMultipleCertificateMatchCriteria','ClientCertificateSelectionCriteriaType','ClientComputerCommunicationType') + $defaultValues += @( + 'ClientCheckCertificateRevocationListForSiteSystem','UsePkiClientCertificate','RequireSigning','UseEncryption', + 'EnableLowFreeSpaceAlert','EnableWakeOnLan','ClientCertificateCustomStoreName','TakeActionForMultipleCertificateMatchCriteria', + 'ClientCertificateSelectionCriteriaType','ClientComputerCommunicationType' + ) if (($PSBoundParameters.ContainsKey('UseSmsGeneratedCert')) -and (-not [string]::IsNullOrEmpty($ClientComputerCommunicationType) -and $ClientComputerCommunicationType -eq 'HttpsOnly') -or @@ -1145,9 +1152,11 @@ function Test-TargetResource } } - $wolParams = @('WakeOnLanTransmissionMethodType','RetryNumberOfSendingWakeupPacketTransmission','SendingWakeupPacketTransmissionDelayMins', - 'MaximumNumberOfSendingWakeupPacketBeforePausing','SendingWakeupPacketBeforePausingWaitSec','ThreadNumberOfSendingWakeupPacket', - 'SendingWakeupPacketTransmissionOffsetMins') + $wolParams = @( + 'WakeOnLanTransmissionMethodType','RetryNumberOfSendingWakeupPacketTransmission','SendingWakeupPacketTransmissionDelayMins', + 'MaximumNumberOfSendingWakeupPacketBeforePausing','SendingWakeupPacketBeforePausingWaitSec','ThreadNumberOfSendingWakeupPacket', + 'SendingWakeupPacketTransmissionOffsetMins' + ) foreach ($param in $wolParams) { diff --git a/tests/Unit/CMSiteConfiguration.tests.ps1 b/tests/Unit/CMSiteConfiguration.tests.ps1 index fa572ac..42dd739 100644 --- a/tests/Unit/CMSiteConfiguration.tests.ps1 +++ b/tests/Unit/CMSiteConfiguration.tests.ps1 @@ -36,7 +36,7 @@ Invoke-TestSetup try { InModuleScope $script:dscResourceName { - Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Get-TargetResource' -Tag 'Get'{ + Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Get-TargetResource' -Tag 'Get' { BeforeAll { $getInput = @{ SiteCode = 'Lab' @@ -451,7 +451,6 @@ try Value = 1 } ) - } $wolBroadcast = @{ @@ -482,7 +481,6 @@ try Value = 2 } ) - } $wolComponent = @{ @@ -920,7 +918,7 @@ try } } - Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Set-TargetResource' -Tag 'Set'{ + Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Set-TargetResource' -Tag 'Set' { BeforeAll { $getReturnAll = @{ SiteCode = 'Lab' @@ -1032,7 +1030,6 @@ try SiteCode = 'Lab' UseSmsGeneratedCert = $true ClientComputerCommunicationType = 'HttpsOnly' - } $inputWakeFalse = @{ @@ -1282,7 +1279,7 @@ try } } - Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Test-TargetResource' -Tag 'Test'{ + Describe 'ConfigMgrCBDsc - DSC_CMSiteConfiguration\Test-TargetResource' -Tag 'Test' { BeforeAll { $getReturnAll = @{ SiteCode = 'Lab' diff --git a/tests/Unit/ConfigMgrCBDsc.ReverseDsc.tests.ps1 b/tests/Unit/ConfigMgrCBDsc.ReverseDsc.tests.ps1 index a6213dc..ef84286 100644 --- a/tests/Unit/ConfigMgrCBDsc.ReverseDsc.tests.ps1 +++ b/tests/Unit/ConfigMgrCBDsc.ReverseDsc.tests.ps1 @@ -6119,6 +6119,13 @@ InModuleScope $script:subModuleName { } $invokeSiteConfigurationPri = @{ + ConfigurationName = $null + DependsOn = $null + ModuleName = 'ConfigMgrCBDsc' + ModuleVersion = 1.0.1 + PsDscRunAsCredential = $null + ResourceId = $null + SourceInfo = $null SiteCode = 'Lab' Comment = 'Site Lab' ClientComputerCommunicationType = 'HttpsOrHttp' @@ -6151,6 +6158,7 @@ InModuleScope $script:subModuleName { TakeActionForMultipleCertificateMatchCriteria = 'SelectCertificateWithLongestValidityPeriod' ClientCertificateSelectionCriteriaType = 'ClientAuthentication' ClientCertificateSelectionCriteriaValue = 'Personal' + PSComputerName = 'localhost' } $invokeSiteConfigurationCas = @{