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

xScheduleTask: Cannot disable already present tasks #74

Closed
johlju opened this issue Jun 7, 2017 · 12 comments · Fixed by #132
Closed

xScheduleTask: Cannot disable already present tasks #74

johlju opened this issue Jun 7, 2017 · 12 comments · Fixed by #132
Assignees
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@johlju
Copy link
Member

johlju commented Jun 7, 2017

It's not possible to disable already present tasks because it needs to set required parameters that should not be changed (and might be unknown per target node).

        xScheduledTask 'DisableMyTask'
        {
           TaskName = 'MyTask'
           TaskPath = '\Company'
           Enable = $false
        }
@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jul 11, 2017
@PlagueHO
Copy link
Member

Hi @johlju - ah - I see. You're talking about the ActionExecutable and ScheduleType parameters being required parameters. I'll see what I can do - how urgent is this one?

@johlju
Copy link
Member Author

johlju commented Jul 12, 2017

Not urgent at all for me. Worked around it by using Script-resource instead. But rather use this when it is resolved.

@PlagueHO
Copy link
Member

Hi @johlju - I'll try to get onto this one once PR #98 has been merged.

@johlju
Copy link
Member Author

johlju commented Aug 27, 2017

Sounds great. I hope it will be a small change :) I can review when you are done :)

@matt6697
Copy link
Contributor

matt6697 commented Dec 7, 2017

Issue is the same for deleting existing tasks. The following DSC action fails requiring ActionExecutable and ScheduleType parameters.

xScheduledTask 'DeleteMyTask'
{
TaskName = 'MyTask'
TaskPath = '\Company'
Ensure= 'Absent'
}

Fix needed to automate optimization of Citrix XenDesktop and Microsoft RDS Virtual Desktop Infrastructure master images as described in https://virtualfeller.com/2017/05/04/optimize-vdi-windows-10-scheduled-tasks-original-anniversary-and-creator-updates/

Tasks like Microsoft\Windows\Application Experience\ProgramDataUpdater don't have a valid ScheduleType for the xScheduledTask DSC resource. Executing the same DSC action while setting the ActionExecutable and ScheduleType values also fails with a Trigger type $_ not recognized as the ScheduleType is not one of the ScheduleTypes defined in the switch/case of the GET function.

switch ($trigger.CimClass.CimClassName)
        {
            'MSFT_TaskTimeTrigger'
            {
                $returnScheduleType = 'Once'
                break
            }

            'MSFT_TaskDailyTrigger'
            {
                $returnScheduleType = 'Daily'
                break
            }

            'MSFT_TaskWeeklyTrigger'
            {
                $returnScheduleType = 'Weekly'
                break
            }

            'MSFT_TaskBootTrigger'
            {
                $returnScheduleType = 'AtStartup'
                break
            }

            'MSFT_TaskLogonTrigger'
            {
                $returnScheduleType = 'AtLogon'
                break
            }

            default
            {
                New-InvalidArgumentException -Message "Trigger type $_ not recognized." -ArgumentName CimClassName
            }
}

@ttdgcp
Copy link

ttdgcp commented Dec 27, 2017

@PlagueHO Hey Daniel, I'm running into issues trying to use DSC and xScheduleTask to delete the "Xbox" scheduled tasks that Server 2016 creates... (I know, right?)... I was wondering if you have any cycles to take a look at the necessary changes to support deleting these tasks?

From what I'm able to glean, the ActionExecutable and ScheduleType parameters being required parameters is what is causing this issue... perhaps we can make them not required when deleting?

If there is any further detail or assistance I can provide, please let me know!

@PlagueHO
Copy link
Member

Hi @ttdgcp - Now that I've finished updating this module to HQRM I'll begin working on the features like this one. I actually started this a little while back so I'll try and work on this one this weekend (as well as some stuff on WsManDsc).

@matt6697
Copy link
Contributor

matt6697 commented Jan 8, 2018

@PlagueHO : Planning to rebuild my https://github.com/puppetlabs/puppetlabs-dsc fork with up to date powershell dsc modules (including sqlserverdsc update). When do you think you'll gonna be able to release the modifications required for scheduled task removal ? Fix needed for https://github.com/virtualdesktopdevops/xd7vda.

@PlagueHO
Copy link
Member

PlagueHO commented Jan 9, 2018

Hi @matt6697 - this is in progress but I haven't managed to finish it yet (still working on updating the tests and other fun stuff like that). I'm hoping to get some free time this week to complete it. Sorry about taking so long!

@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 Jan 9, 2018
@PlagueHO
Copy link
Member

PlagueHO commented Jan 9, 2018

Nearly finished now. I have completed all the new tests required for this change. Just need to make the pass 😉 . Still aim to have this complete over the next couple of days.

Note: This change will be a breaking change because I'm going to have to remove some fields from the Get-TargetResource because of making some of the fields now optional. So a new major version of the resource module will be released.

@matt6697
Copy link
Contributor

matt6697 commented Jan 9, 2018

@PlagueHO : Hi Daniel, thanks for the update :-)

@PlagueHO
Copy link
Member

Almost there! Should have the PR submitted tomorrow. New integration tests completed and passing, but unit tests are still failing. Need to increase the unit test coverage on the new code I added.

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. in progress The issue is being actively worked on by someone.
Projects
None yet
4 participants