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: NOTMATCH when using SynchronizeAcrossTimeZone #374

Open
shurick81 opened this issue May 18, 2021 · 2 comments · May be fixed by #440
Open

ScheduledTask: NOTMATCH when using SynchronizeAcrossTimeZone #374

shurick81 opened this issue May 18, 2021 · 2 comments · May be fixed by #440
Labels
bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community.

Comments

@shurick81
Copy link

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

Trying to run the task in the specific time according to the local time zone (Stockholm) with daylight saving. Start-DscConfiguration works without issues. Test-DscConfiguration however, throws an error and returns ResourcesNotInDesiredState.

If I try with SynchronizeAcrossTimeZone = $false the code is executing without errors but then it looks like startup time is not corrected according to daylight saving.

If I keep SynchronizeAcrossTimeZone = $false but disable daylight saving on the target node, it is also executing without errors.

Verbose logs showing the problem

VERBOSE: [SWAZDB00]: LCM:  [ Start  Compare  ]
VERBOSE: [SWAZDB00]: LCM:  [ Start  Resource ]  [[ScheduledTask]CubeDefinitionDeployment]
VERBOSE: [SWAZDB00]: LCM:  [ Start  Test     ]  [[ScheduledTask]CubeDefinitionDeployment]
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Testing scheduled task
'Automatisk uppdatering av kubdefinitioner' in '\'.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Getting current scheduled
task values for task 'Automatisk uppdatering av kubdefinitioner' in '\'.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Task 'Automatisk uppdatering
av kubdefinitioner' found in '\'. Retrieving settings, first action, first trigger and repetition settings.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Detected schedule type
'Daily' for first trigger.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Current scheduled task values
 for task 'Automatisk uppdatering av kubdefinitioner' in '\' retrieved.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Testing DSC parameter state.
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] NOTMATCH: Value (type
'System.String') for property 'StartTime' does not match. Current state is '2021-01-01T05:45:00+02:00' and desired
state is '2021-01-01T06:45:00+02:00'. (DRC0021)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.Boolean') for property 'SynchronizeAcrossTimeZone' does match. Current state is 'True' and desired state is
'True'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'ActionExecutable' does match. Current state is
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' and desired state is
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'ExecuteAsCredential' does match. Current state is 'C0NT0S00\_testuser1' and desired
state is 'C0NT0S00\_testuser1'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'TaskPath' does match. Current state is '\' and desired state is '\'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.UInt32') for property 'DaysInterval' does match. Current state is '1' and desired state is '1'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'ActionWorkingPath' does match. Current state is
'C:\AutomatiskUppdateringKubdefinitioner\Test' and desired state is 'C:\AutomatiskUppdateringKubdefinitioner\Test'.
(DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'ScheduleType' does match. Current state is 'Daily' and desired state is 'Daily'.
(DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] MATCH: Value (type
'System.String') for property 'TaskName' does match. Current state is 'Automatisk uppdatering av kubdefinitioner' and
desired state is 'Automatisk uppdatering av kubdefinitioner'. (DRC0020)
VERBOSE: [SWAZDB00]:                            [[ScheduledTask]CubeDefinitionDeployment] Test-DscParameter result is
'False'. (DRC0026)
VERBOSE: [SWAZDB00]: LCM:  [ End    Test     ]  [[ScheduledTask]CubeDefinitionDeployment] False in 0.2500 seconds.
VERBOSE: [SWAZDB00]: LCM:  [ End    Resource ]  [[ScheduledTask]CubeDefinitionDeployment]
VERBOSE: [SWAZDB00]: LCM:  [ End    Compare  ]     Completed processing compare operation. The operation returned
False.
VERBOSE: [SWAZDB00]: LCM:  [ End    Compare  ]    in  0.3590 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.

Suggested solution to the issue

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

        ScheduledTask CubeDefinitionDeployment
        {
            TaskName                    = 'Automatisk uppdatering av kubdefinitioner'
            ActionExecutable            = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
            ActionWorkingPath           = $env:SSAS_SCHEDULED_TASK_DIR
            ScheduleType                = 'Daily'
            StartTime                   = '2021-01-01T05:45:00'
            SynchronizeAcrossTimeZone   = $true
            ExecuteAsCredential         = $SsasScheduledTaskCredential
            DaysInterval                = 1
        }

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.4402.amd64fre.rs1_release.210426-1725
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.14393.4402
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.4402
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)

8.4.0

@PlagueHO PlagueHO added bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community. labels May 23, 2021
@Borgquite
Copy link
Contributor

What if you specify your TimeZone in StartAt, does that help?

StartTime = '2021-01-01T05:45:00+02:00'

@Borgquite
Copy link
Contributor

Borgquite commented Nov 26, 2024

Don't worry - I think I found it:

$returnDate = (Get-Date -Date $Date -Format $format) + (Get-Date -Format 'zzz')

This line gets the supplied date time in sortable format - then appends today's time zone offset to the end (because Get-Date defaults to today if a date is not supplied. This should be the supplied date time zone offset (e.g. $Date) so that if the supplied date falls into daylight savings time, the offset is updated.

PR should fix.

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. needs investigation The issue needs to be investigated by the maintainers or/and the community.
Projects
None yet
3 participants