From 23e637899587cfa69f7c9a374a6ef209dc37f913 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Tue, 25 Jun 2019 18:45:38 +0300 Subject: [PATCH 01/13] Removing helper function A built in function with the same name exists that works fine on all modern versions of Windwos (2012R2 and never). This helper function does not work with all scheduled tasks. --- .../MSFT_ScheduledTask.psm1 | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/DSCResources/MSFT_ScheduledTask/MSFT_ScheduledTask.psm1 b/DSCResources/MSFT_ScheduledTask/MSFT_ScheduledTask.psm1 index 69cf0a46..fe7f83d2 100644 --- a/DSCResources/MSFT_ScheduledTask/MSFT_ScheduledTask.psm1 +++ b/DSCResources/MSFT_ScheduledTask/MSFT_ScheduledTask.psm1 @@ -2073,35 +2073,6 @@ function ConvertTo-TimeSpanStringFromScheduledTaskString return (New-TimeSpan -Days $days -Hours $hours -Minutes $minutes -Seconds $seconds).ToString() } -<# - .SYNOPSIS - Helper function to disable an existing scheduled task. - - .PARAMETER TaskName - The name of the task to disable. - - .PARAMETER TaskPath - The path to the task to disable. -#> -function Disable-ScheduledTask -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $TaskName, - - [Parameter()] - [System.String] - $TaskPath = '\' - ) - - $existingTask = Get-ScheduledTask @PSBoundParameters - $existingTask.Settings.Enabled = $false - $null = $existingTask | Register-ScheduledTask @PSBoundParameters -Force -} - <# .SYNOPSIS Returns a formatted datetime string for use in ScheduledTask resource. From d68c4b2f0832ed4eded3b573edb5b4fe0276acd2 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 10:10:13 +0100 Subject: [PATCH 02/13] Update MSFT_ScheduledTask.Tests.ps1 Removing tests that are no longer needed after Disable-ScheduledTask helper function was removed. --- Tests/Unit/MSFT_ScheduledTask.Tests.ps1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 b/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 index 348b4a0b..1224dbc4 100644 --- a/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 +++ b/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 @@ -165,10 +165,6 @@ try Test-TargetResource @testParameters | Should -Be $false } - It 'Should remove the scheduled task in the set method' { - Set-TargetResource @testParameters - Assert-MockCalled Unregister-ScheduledTask - } } Context 'A built-in scheduled task exists and is enabled, but it should be disabled' { @@ -1543,11 +1539,6 @@ try It 'Should return false from the test method' { Test-TargetResource @testParameters | Should -Be $false } - - It 'Should disable the scheduled task in the set method' { - Set-TargetResource @testParameters - Assert-MockCalled Register-ScheduledTask -Exactly -Times 1 - } } Context 'When a scheduled task with an OnEvent scheduletype is in desired state' { From a6e68c99234076ea8d904c5c5a53bc4988f753c1 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 10:17:28 +0100 Subject: [PATCH 03/13] Update MSFT_ScheduledTask.Tests.ps1 One more test removed relating to Disable-ScheduledTask --- Tests/Unit/MSFT_ScheduledTask.Tests.ps1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 b/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 index 1224dbc4..a56997f7 100644 --- a/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 +++ b/Tests/Unit/MSFT_ScheduledTask.Tests.ps1 @@ -205,11 +205,6 @@ try It 'Should return false from the test method' { Test-TargetResource @testParameters | Should -Be $false } - - It 'Should remove the scheduled task in the set method' { - Set-TargetResource @testParameters - Assert-MockCalled Register-ScheduledTask -Exactly -Times 1 - } } Context 'A built-in scheduled task exists, but it should be absent' { From 25e82d65379442ecd17f7628eed280af11bd3bd8 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 10:27:15 +0100 Subject: [PATCH 04/13] Update CHANGELOG.md Updated CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 416fae4c..e0635800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Versions ## Unreleased +- ScheduledTask: +Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks, it fails with a CIM error. Removing this function means that config is using built-in Disable-ScheduledTask PowerShell. function which works as expected ## 6.4.0.0 From 9edfe706d295c4b1230252d47ac77d7ca0be6c56 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 10:56:50 +0100 Subject: [PATCH 05/13] Update CHANGELOG.md Correcting errors in CHANGELOG --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0635800..2467f126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## Unreleased - ScheduledTask: -Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks, it fails with a CIM error. Removing this function means that config is using built-in Disable-ScheduledTask PowerShell. function which works as expected + - Removed Disable-ScheduledTask helper function as it does not work with most of + the built-in scheduled tasks, it fails with a CIM error. Removing this function means that + config is using built-in Disable-ScheduledTask PowerShell. function which works as expected + ## 6.4.0.0 From bfcffa3ed01940610f8e7de18242ef50048446df Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 10:58:49 +0100 Subject: [PATCH 06/13] Update CHANGELOG.md Adding fixed issue reference --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22fa53b3..f881d522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - ScheduledTask: - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks, it fails with a CIM error. Removing this function means that - config is using built-in Disable-ScheduledTask PowerShell. function which works as expected + config is using built-in Disable-ScheduledTask PowerShell. function which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - xComputer: From 3b60da5200b8b9ab3fec7d2262238378b93e1d17 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 11:26:12 +0100 Subject: [PATCH 07/13] Update CHANGELOG.md Fixing errors in changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f881d522..79353a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ # Versions ## Unreleased -- ScheduledTask: + + - ScheduledTask: - Removed Disable-ScheduledTask helper function as it does not work with most of - the built-in scheduled tasks, it fails with a CIM error. Removing this function means that + the built-in scheduled tasks, it fails with a CIM error. Removing this function means that config is using built-in Disable-ScheduledTask PowerShell. function which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - - xComputer: - Fix for 'directory service is busy' error when joining a domain and renaming From 91313bac1736c2167704cf7cde5d533a265c503a Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 12:33:40 +0100 Subject: [PATCH 08/13] Update CHANGELOG.md Correcting the errors in changelog again --- CHANGELOG.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79353a3b..009b3fba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,8 @@ ## Unreleased - ScheduledTask: - - Removed Disable-ScheduledTask helper function as it does not work with most of - the built-in scheduled tasks, it fails with a CIM error. Removing this function means that - config is using built-in Disable-ScheduledTask PowerShell. function which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - + - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). + - xComputer: - Fix for 'directory service is busy' error when joining a domain and renaming a computer when JoinOU is specified - Fixes [Issue #221](https://github.com/PowerShell/ComputerManagementDsc/issues/221). From f9c00477f3d94f1e639bc3874a5d602489977c92 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Thu, 27 Jun 2019 13:14:40 +0100 Subject: [PATCH 09/13] Update CHANGELOG.md Trying to fix whatever is wrong with formating in changelog.md --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 009b3fba..a19df98c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## Unreleased - - ScheduledTask: - - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - +- ScheduledTask: + - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks + Removing the function means that built-in one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - xComputer: - Fix for 'directory service is busy' error when joining a domain and renaming a computer when JoinOU is specified - Fixes [Issue #221](https://github.com/PowerShell/ComputerManagementDsc/issues/221). From ee084869f8e7fe91aa156bb1953356d6b5f7e0ef Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Mon, 1 Jul 2019 06:44:00 +0100 Subject: [PATCH 10/13] Update CHANGELOG.md Trying once again to fix the errros in the changelog file. --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a19df98c..246fc4f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,9 @@ ## Unreleased - ScheduledTask: - - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks - Removing the function means that built-in one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). + - Removed Disable-ScheduledTask helper function as it does not work with most + of the built-in scheduled tasks. Removing the function means that built-in + one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - xComputer: - Fix for 'directory service is busy' error when joining a domain and renaming a computer when JoinOU is specified - Fixes [Issue #221](https://github.com/PowerShell/ComputerManagementDsc/issues/221). From fedc6aa3958e6c688266cba7065027dc2acd8bd2 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Tue, 13 Aug 2019 09:28:48 +0300 Subject: [PATCH 11/13] Correcting CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 136639a7..83535d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ of the built-in scheduled tasks. Removing the function means that built-in one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - xComputer: + ======= + ## 6.5.0.0 - Computer: From 6edd53f4e1c2580f52d8c54addb7ba4cd980ee01 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Wed, 14 Aug 2019 17:12:02 +0300 Subject: [PATCH 12/13] FIxing CHANGELOG.md --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83535d67..45e06c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,6 @@ - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks. Removing the function means that built-in one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). -- xComputer: - -======= ## 6.5.0.0 From 6d845e7cea726cb7963bf10577c9438bbc524548 Mon Sep 17 00:00:00 2001 From: Edgar Dockus Date: Tue, 27 Aug 2019 18:06:08 +0300 Subject: [PATCH 13/13] Fixing conflicts --- CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b72366e1..185a77d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ - Removed Disable-ScheduledTask helper function as it does not work with most of the built-in scheduled tasks. Removing the function means that built-in one is used instead which works as expected - Fixes [Issue #137](https://github.com/PowerShell/ComputerManagementDsc/issues/137). - +- Changes to ScheduledTask: + - Delay property not handled properly on AtLogon and AtStartup trigger - Fixes + [Issue #230](https://github.com/PowerShell/ComputerManagementDsc/issues/230) - PendingReboot: - Migrated xPendingReboot from [xPendingReboot](https://github.com/PowerShell/xPendingReboot) and renamed to PendingReboot. @@ -23,6 +25,21 @@ - Deleted the code that removes the `regRebootLocations` variable at the end of the resource as it appears to serve no purpose. - Correct all tests to meet Pester 4.0 standards. +- RemoteDesktopAdmin: + - New resource for configuring Remote Desktop for Administration - fixes + [Issue #224](https://github.com/PowerShell/ComputerManagementDsc/issues/224). +- Updated common function `Test-DscParameterState` to support ordered comparison + of arrays by copying function and tests from `NetworkingDsc` - fixes [Issue #250](https://github.com/PowerShell/ComputerManagementDsc/issues/250). +- BREAKING CHANGE: ScheduledTask: + - Correct output type of `DaysInterval`,`StartTime`,`WeeksDaysOfWeek`, + and `WeeksInterval` parameters from `Get-TargetResource` to match MOF. + - Refactored `Get-TargetResource` to remove parameters that + are not key or required - fixes [Issue #249](https://github.com/PowerShell/ComputerManagementDsc/issues/249). + - Added function `Test-DateStringContainsTimeZone` to determine if a string + containing a date time includes a time zone. + - Enable verbose preference to be passed through to `Test-DscParameterState`. + - Changed `Test-TargetResource` so that `StartTime` is only compared for + trigger types `Daily`,`Weekly` or `Once`. ## 6.5.0.0