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

ScheduledTask: Newlines or white-spaces at start or end of description causes repeated drifts #258

Closed
dappleby300 opened this issue Sep 6, 2019 · 1 comment · Fixed by #279
Labels
bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub in progress The issue is being actively worked on by someone.

Comments

@dappleby300
Copy link

Details of the scenario you tried and the problem that is occurring

If there is new lines or whitespace at the start or end of the task description the configuration constantly drifts

Verbose logs showing the problem

The verbose logs to do not show the reason for the drift

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer SKYPE19-FE-FD1 with user sid S-1-5-21-3168950514-858783772-3390967778-1601.
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ Start  Compare  ]
WARNING: [SKYPE19-FE-FD1]:                            [DSCEngine] Warning LCM is in Debug 'ResourceScriptBreakAll' mode.  Resource script processing will be stopped to wait for PowerShell script debugger to attach.
VERBOSE: [SKYPE19-FE-FD1]:                            [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\ComputerManagementDsc\6.5.0.0\DscResources\MSFT_ScheduledTask\MSFT_ScheduledTask.psm1 in force mode.
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ Start  Resource ]  [[ScheduledTask]TestTask]
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ Start  Test     ]  [[ScheduledTask]TestTask]
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Importing the module MSFT_ScheduledTask in force mode.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Testing scheduled task 'TestTask' in '\'.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Getting scheduled task 'TestTask' in '\'.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Task 'TestTask' found in '\'. Retrieving settings, first action, first trigger and repetition settings.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Detected schedule type 'Daily' for first trigger.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Current scheduled task values retrieved.
VERBOSE: [SKYPE19-FE-FD1]:                            [[ScheduledTask]TestTask] Testing DSC parameter state.
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ End    Test     ]  [[ScheduledTask]TestTask] False in 250.9800 seconds.
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ End    Resource ]  [[ScheduledTask]TestTask]
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ End    Compare  ]     Completed processing compare operation. The operation returned False.
VERBOSE: [SKYPE19-FE-FD1]: LCM:  [ End    Compare  ]    in  251.2320 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.

Suggested solution to the issue

Remove all white-space,newlines and carriage returns from the start and end of the description.

.Trim(" ","`t","`n","`r")

The DSC configuration that is used to reproduce the issue (as detailed as possible)

        ScheduledTask 'TestTask'
        {
            Ensure                  = 'Present'
            TaskName                = 'TestTask'
            Description             =  "  Test Task
"
            ActionExecutable        = 'c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
            ScheduleType            = 'Daily'
            StartTime               = '2019-01-01 20:45:00'
        }

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
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.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

6.5.0.0

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub labels Sep 7, 2019
@PlagueHO
Copy link
Member

PlagueHO commented Sep 7, 2019

Hi @dappleby300 - good catch. Should be a simple fix. Thanks for raising this.

@PlagueHO PlagueHO added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Oct 4, 2019
PlagueHO added a commit to PlagueHO/ComputerManagementDsc that referenced this issue Oct 4, 2019
PlagueHO added a commit that referenced this issue Oct 7, 2019
Fix ScheduledTask Description Whitespace issue - Fixes #258
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. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub in progress The issue is being actively worked on by someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants