dsccommunity / dsccommunity/ComputerManagementDsc

xScheduledTask - Throws an error if no ScheduleType is specified.

Open
#149 2 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

Hi there. I'm attempting to create a scheduled task that will be called by another process. The scheduled task is not to have an actual schedule for it. When creating the scheduled task with DSC, I get the following error if no ScheduleType is specified. However, if the ScheduleType is set, it creates the task just fine:


PowerShell Desired State Configuration does not support execution of commands in an interactive mode. Please ensure that the 
underlying command is not prompting for user input, such as missing mandatory parameter, confirmation prompt etc.
    + CategoryInfo          : OperationStopped: (:) [], CimException
    + FullyQualifiedErrorId : System.NotSupportedException
    + PSComputerName        : localhost
 
Cannot validate argument on parameter 'ErrorRecord'. The argument is null. Provide a valid value for the argument, and then try 
running the command again.
    + CategoryInfo          : InvalidData: (:) [], CimException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-InvalidOperationException
    + PSComputerName        : localhost

Resource Config


        xScheduledTask TaskName
        {
            TaskName = "TaskName"
            ActionArguments = "-nolog -command cmdkey /generic:TERMSRV/localhost /user:$($User.UserName) /pass:$($User.GetNetworkCredential().Password); mstsc /v:localhost:3389"
            ActionExecutable = 'c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
            Description = ("Enable RDP for user " + UserName)
            Enable = $true
            Ensure = 'Present'
            ExecuteAsCredential = $UserAdmin
            LogonType = 'Interactive'
            TaskPath = 'CustomTasks'
            User = $UserAdmin.UserName


        }

Server 2012 R2 Datacenter - PSVersion 5.1.14409.1005

Import-DscResource -ModuleName xComputerManagement -ModuleVersion '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 with the xScheduledTask resource implementation and trace how an omitted ScheduleType is handled when applying the provided DSC configuration. Reproduce the failure on the stated PowerShell and Windows Server versions, then verify that a task without an actual schedule can be created without the reported validation errors.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.