dsccommunity / dsccommunity/ComputerManagementDsc

xScheduledTask: test is always false

Open
#144 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
PowerShell
Stars
338
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring:
Simply want to deploy 3 scheduled tasks.
I run Start-Dsc... and it works perfectly and creates scheduled tasks that work without issues.
However, when I run test, I receive False:

VERBOSE: [tst01sp16]: LCM:  [ Start  Resource ]  [[xScheduledTask]SiteCreationTask]
VERBOSE: [tst01sp16]: LCM:  [ Start  Test     ]  [[xScheduledTask]SiteCreationTask]
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Testing scheduled task 'Mitt Skap Personal Site Creation' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Getting scheduled task 'Mitt Skap Personal Site Creation' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Task 'Mitt Skap Personal Site Creation' found in '\'. Retrieving settings, first action, first trigger and repetition settings.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Detected schedule type 'Daily' for first trigger.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Current scheduled task values retrieved.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteCreationTask] Testing DSC parameter state.
VERBOSE: [tst01sp16]: LCM:  [ End    Test     ]  [[xScheduledTask]SiteCreationTask] False in 2.4840 seconds.
VERBOSE: [tst01sp16]: LCM:  [ End    Resource ]  [[xScheduledTask]SiteCreationTask]
VERBOSE: [tst01sp16]: LCM:  [ Start  Resource ]  [[xScheduledTask]SiteProvisioningTask]
VERBOSE: [tst01sp16]: LCM:  [ Start  Test     ]  [[xScheduledTask]SiteProvisioningTask]
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Testing scheduled task 'Mitt Skap Site Provisioning' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Getting scheduled task 'Mitt Skap Site Provisioning' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Task 'Mitt Skap Site Provisioning' found in '\'. Retrieving settings, first action, first trigger and repetition settings.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Detected schedule type 'Daily' for first trigger.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Current scheduled task values retrieved.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]SiteProvisioningTask] Testing DSC parameter state.
VERBOSE: [tst01sp16]: LCM:  [ End    Test     ]  [[xScheduledTask]SiteProvisioningTask] False in 0.5470 seconds.
VERBOSE: [tst01sp16]: LCM:  [ End    Resource ]  [[xScheduledTask]SiteProvisioningTask]
VERBOSE: [tst01sp16]: LCM:  [ Start  Resource ]  [[xScheduledTask]DatabaseDistributionTask]
VERBOSE: [tst01sp16]: LCM:  [ Start  Test     ]  [[xScheduledTask]DatabaseDistributionTask]
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Testing scheduled task 'Mitt Skap DatabaseDistributing' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Getting scheduled task 'Mitt Skap DatabaseDistributing' in '\'.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Task 'Mitt Skap DatabaseDistributing' found in '\'. Retrieving settings, first action, first trigger and repetition settings.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Detected schedule type 'Daily' for first trigger.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Current scheduled task values retrieved.
VERBOSE: [tst01sp16]:                            [[xScheduledTask]DatabaseDistributionTask] Testing DSC parameter state.
VERBOSE: [tst01sp16]: LCM:  [ End    Test     ]  [[xScheduledTask]DatabaseDistributionTask] False in 0.5320 seconds.
VERBOSE: [tst01sp16]: LCM:  [ End    Resource ]  [[xScheduledTask]DatabaseDistributionTask]

The DSC configuration that is using the resource (as detailed as possible):

        xScheduledTask SiteCreationTask
        {
            TaskName                = 'Mitt Skap Personal Site Creation'
            ActionExecutable        = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
            ActionArguments         = "-Command `"& '.\PersonalSiteCreation.ps1' -mysiteurl 'https://$siteCollectionHostNameMinerva/sites/my' -pathcsv '$mittSkapAccountsCsvUrl'`""
            ActionWorkingPath       = "$MittSkapLocalFolder"
            ScheduleType            = "Daily"
            StartTime               = "4:40"
            ExecuteAsCredential     = $SPBatchCredential
            RunLevel                = 'Highest'
            PsDscRunAsCredential    = $SPBatchCredential
        }

        xScheduledTask SiteProvisioningTask
        {
            TaskName                = 'Mitt Skap Site Provisioning'
            ActionExecutable        = "$MittSkapLocalFolder\MyCabinetJob\MyCabinet.Job.exe"
            ActionWorkingPath       = "$MittSkapLocalFolder\MyCabinetJob"
            ScheduleType            = "Daily"
            StartTime               = "5:00"
            ExecuteAsCredential     = $SPBatchCredential
            RunLevel                = 'Highest'
            PsDscRunAsCredential    = $SPBatchCredential
        }

        xScheduledTask DatabaseDistributionTask
        {
            TaskName                = "Mitt Skap DatabaseDistributing"
            ActionExecutable        = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
            ActionArguments         = "-Command `"& '.\DistributingDatabases.ps1'`""
            ActionWorkingPath       = "$MittSkapLocalFolder\Logs"
            ScheduleType            = "Daily"
            StartTime               = "5:20"
            ExecuteAsCredential     = $SPBatchCredential
            RunLevel                = 'Highest'
            PsDscRunAsCredential    = $SPBatchCredential
        }

Version of the Operating System and PowerShell the DSC Target Node is running:
Win 2016, PS 5.1
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
4.0.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior on Windows Server 2016 with PowerShell 5.1 and ComputerManagementDsc 4.0.0.0, using the three scheduled-task configurations in the issue. Compare the resource's configuration and test results after deployment; done means Test returns true for all three tasks. No source file or test path is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.