From b531397e40f5387782bbf69aa9e78ff1a3dff753 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Mon, 11 Dec 2017 14:35:15 +0100 Subject: [PATCH] Fix review comments at r1 --- .../MSFT_xADComputer/MSFT_xADComputer.psm1 | 6 +++--- .../MSFT_xADComputer/MSFT_xADComputer.schema.mof | 2 +- README.md | 10 +++++----- Tests/Unit/MSFT_xADComputer.Tests.ps1 | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 b/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 index df84f2c29..1b6303acd 100644 --- a/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 +++ b/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 @@ -243,7 +243,7 @@ function Test-TargetResource } else { - ## Add ensure and enabled as they may not be explicitly passed and we want to enumerate them + # Add ensure as it may not be explicitly passed and we want to enumerate it. $PSBoundParameters['Ensure'] = $Ensure; foreach ($parameter in $PSBoundParameters.Keys) @@ -531,7 +531,7 @@ function Set-TargetResource $setADComputerParams contains more than one value (ignoring parameter 'Identity' by itself). #> - if ($replaceComputerProperties.Count -or $removeComputerProperties.Count -or $setADComputerParams.Count -gt 1) + if ($replaceComputerProperties.Count -gt 0 -or $removeComputerProperties.Count -gt 0 -or $setADComputerParams.Count -gt 1) { ## Only pass -Remove and/or -Replace if we have something to set/change if ($replaceComputerProperties.Count -gt 0) @@ -576,7 +576,7 @@ function Set-DscADComputer { param ( - [Parameter()] + [Parameter(Mandatory = $true)] [System.Collections.Hashtable] $SetADComputerParameters ) diff --git a/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof b/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof index 09b5cadaf..08c824fc2 100644 --- a/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof +++ b/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof @@ -15,7 +15,7 @@ class MSFT_xADComputer : OMI_BaseResource [Write, Description("Specifies the user account credentials to use to perform the task"), EmbeddedInstance("MSFT_Credential")] String DomainAdministratorCredential; [Write, Description("Specifies the full path to the Offline Domain Join Request file to create.")] String RequestFile; [Write, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies if the the computer account should be created disabled ($true) or enabled ($false). Default a computer account will be created as enabled. If the parameter Enabled is used in the same configuration that will override this parameter.")] Boolean CreateDisabled; + [Write, Description("Specifies if the the computer account should be created disabled ($true) or enabled ($false). By default a computer account will be created as enabled. If the parameter Enabled is used in the same configuration then that will override this parameter.")] Boolean CreateDisabled; [Read, Description("Returns the X.500 path of the computer object")] String DistinguishedName; [Read, Description("Returns the security identifier of the computer object")] String SID; }; diff --git a/README.md b/README.md index 857060d37..ad1d2b153 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ The xADComputer DSC resource will manage computer accounts within Active Directo * **DistinguishedName**: Returns the X.500 path of the computer object (read-only). * **SID**: Returns the security identifier of the computer object (read-only). * **CreateDisabled*: Specifies if the the computer account should be created disabled ($true) - or enabled ($false). Default a computer account will be created as enabled. If + or enabled ($false). By default a computer account will be created as enabled. If the parameter Enabled is used in the same configuration then that will override this parameter. @@ -302,13 +302,13 @@ Setting an ODJ Request file path for a configuration that creates a computer acc * Added xADServicePrincipalName resource. * Changes to xADComputer * BREAKING CHANGE: Previously a computer account was always set to enabled - regardless of `Enabled` parameter was used in a configuration. Now if + regardless if the `Enabled` parameter was used in a configuration. Now if the `Enabled` parameter is left out of the configuration, the - computer account will not be evaluated if it enabled. So if a computer is - disabled, the resource will not enabled it unless `Enabled` parameter is + computer account will not be evaluated if it is enabled. So if a computer is + disabled, the resource will not enable it unless the `Enabled` parameter is set to `$true` in the configuration. * A computer account can now be created disabled by setting the parameter - `CreateDisabled` to `$true`. Default a computer account will be created + `CreateDisabled` to `$true`. By default a computer account will be created as enabled. ### 2.16.0.0 diff --git a/Tests/Unit/MSFT_xADComputer.Tests.ps1 b/Tests/Unit/MSFT_xADComputer.Tests.ps1 index a5c432f6f..f56023b87 100644 --- a/Tests/Unit/MSFT_xADComputer.Tests.ps1 +++ b/Tests/Unit/MSFT_xADComputer.Tests.ps1 @@ -672,7 +672,7 @@ try } Context 'When not specifying the parameter Enabled' { - It 'Should create a computer account that are enabled' { + It 'Should create a computer account that is enabled' { $setTargetResourceParameters = $testPresentParams.Clone() Set-TargetResource @setTargetResourceParameters @@ -688,7 +688,7 @@ try } Context 'When specifying the parameter Enabled with the value $true' { - It 'Should create a computer account that are enabled' { + It 'Should create a computer account that is enabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['Enabled'] = $true @@ -705,7 +705,7 @@ try } Context 'When specifying the parameter CreateDisabled with the value $false and parameter Enabled with value $true' { - It 'Should create a computer account that are enabled' { + It 'Should create a computer account that is enabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['CreateDisabled'] = $false $setTargetResourceParameters['Enabled'] = $true @@ -757,7 +757,7 @@ try } Context 'When specifying the parameter Enabled with the value $false' { - It 'Should create a computer account that are disabled' { + It 'Should create a computer account that is disabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['Enabled'] = $false @@ -774,7 +774,7 @@ try } Context 'When specifying the parameter CreateDisabled with the value $true' { - It 'Should create a computer account that are disabled' { + It 'Should create a computer account that is disabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['CreateDisabled'] = $true @@ -791,7 +791,7 @@ try } Context 'When specifying the parameter CreateDisabled with the value $false and Enabled with value $false' { - It 'Should create a computer account that are disabled' { + It 'Should create a computer account that is disabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['CreateDisabled'] = $false $setTargetResourceParameters['Enabled'] = $false @@ -809,7 +809,7 @@ try } Context 'When specifying the parameter CreateDisabled with the value $true and Enabled with value $false' { - It 'Should create a computer account that are disabled' { + It 'Should create a computer account that is disabled' { $setTargetResourceParameters = $testPresentParams.Clone() $setTargetResourceParameters['CreateDisabled'] = $true $setTargetResourceParameters['Enabled'] = $false