You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
I am trying to disable a scheduled task and using the below config for this. Since I am only interested in disabling the scheduled task, I do not provide any of the Action* parameters like ActionExecutable.
During some testing, I ran into a situation where my scheduled task wasn't properly created. When the ScheduledTask resource then ran, it threw some errors. If skipped the first check in the Set-TargetResource method, because the currentValues.Enable parameters wasn't True (since it didn't exist):
The code then tried to create a new task, which failed because I wasn't providing any of the Action parameters.
Verbose logs showing the problem
VERBOSE: [SERVER]: [[ScheduledTask]DisableWFSchedTask] Current scheduled task values for task 'Workflow Manager 1.0 CEIP Uploader Task' in '\Microsoft\Windows\PowerShell\ScheduledJobs\' retrieved.
Cannot validate argument on parameter 'Execute'. The argument is null or empty. Provide an argument that is not null or
empty, and then try the command again.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,New-ScheduledTaskAction
+ PSComputerName : localhost
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 : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : RemoteHostExecutionException
+ 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
You cannot call a method on a null-valued expression.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : InvokeMethodOnNull
+ PSComputerName : localhost
VERBOSE: [SERVER]: [[ScheduledTask]DisableWFSchedTask] Creating scheduled task principal for account 'NT AUTHORITY\SYSTEM' using logon type 'ServiceAccount'.
Cannot validate argument on parameter 'Action'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,New-ScheduledTask
+ PSComputerName : localhost
VERBOSE: [SERVER]: [[ScheduledTask]DisableWFSchedTask] Creating new scheduled task 'Workflow Manager 1.0 CEIP Uploader Task' in '\Microsoft\Windows\PowerShell\ScheduledJobs\'.
Cannot index into a null array.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NullArray
+ PSComputerName : localhost
VERBOSE: [SERVER]: [[ScheduledTask]DisableWFSchedTask] Creating new scheduled task 'Workflow Manager 1.0 CEIP Uploader Task' in '\Microsoft\Windows\PowerShell\ScheduledJobs\'.
Cannot validate argument on parameter 'InputObject'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Register-ScheduledTask
+ PSComputerName : localhost
VERBOSE: [SERVER]: LCM: [ End Set ] [[ScheduledTask]DisableWFSchedTask] in 1.4690 seconds.
The PowerShell DSC resource '[ScheduledTask]DisableWFSchedTask' with SourceInfo 'C:\SPSources\2019\Configs\Deploy_SharePoint.ps1::1751::17::ScheduledTask' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
Suggested solution to the issue
I think it would be good to add some parameter validation. If the code tries to create a new task, it should validate if the Action parameters are provided.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Details of the scenario you tried and the problem that is occurring
I am trying to disable a scheduled task and using the below config for this. Since I am only interested in disabling the scheduled task, I do not provide any of the Action* parameters like ActionExecutable.
During some testing, I ran into a situation where my scheduled task wasn't properly created. When the ScheduledTask resource then ran, it threw some errors. If skipped the first check in the Set-TargetResource method, because the currentValues.Enable parameters wasn't True (since it didn't exist):
ComputerManagementDsc/source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.psm1
Lines 451 to 454 in 5a6d855
The code then tried to create a new task, which failed because I wasn't providing any of the Action parameters.
Verbose logs showing the problem
Suggested solution to the issue
I think it would be good to add some parameter validation. If the code tries to create a new task, it should validate if the Action parameters are provided.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.3503.amd64fre.rs1_release.200131-0410
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.14393.3471
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3471
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)
7.1
The text was updated successfully, but these errors were encountered: