-
Notifications
You must be signed in to change notification settings - Fork 82
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] Disabling scheduled task fails with incorrect user name or password error #306
Comments
There is something specific with this task. I am just unable to disable this specific task. When I run the following commands, the same error is displayed $taskname = "Workflow Manager 1.0 CEIP Uploader Task"
$taskpath = "\Microsoft\Windows\PowerShell\ScheduledJobs\"
$task = ScheduledTasks\Get-ScheduledTask -TaskName $taskname -TaskPath $taskpath
$task.Settings.Enabled = $false
$task | Register-ScheduledTask -TaskName $taskname -TaskPath $taskpath -Force
Register-ScheduledTask : The user name or password is incorrect.
At line:6 char:9
+ $task | Register-ScheduledTask -TaskName $taskname -TaskPath $taskpat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x8007052e,Register-ScheduledTask Using the same code for other tasks, they can be disabled just fine. I am running these commands in an elevated PS process. |
Hi @ykuijs - that is pretty odd. What does the $taskname = "Workflow Manager 1.0 CEIP Uploader Task"
$taskpath = "\Microsoft\Windows\PowerShell\ScheduledJobs\"
$task = ScheduledTasks\Get-ScheduledTask -TaskName $taskname -TaskPath $taskpath
$task.Principal |
The Principal is:
|
Did some more troubleshooting and discovered that this code always fails when you create a task that has "Run whether user is logged on or not" configured. The PowerShell native "Disable-ScheduledTask" (PSv5 and above only) works fine on these tasks. |
Details of the scenario you tried and the problem that is occurring
I try to disable a scheduled task using the ScheduledTask resource. Unfortunately this results in the error "The user name or password is incorrect.", thrown by the Register-ScheduledTask cmdlet.
I have been able to track this back to the following lines:
ComputerManagementDsc/source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.psm1
Lines 1634 to 1636 in 794d401
Verbose logs showing the problem
Suggested solution to the issue
Why is is there a custom Disable-ScheduledTask function? When I remove this, so PowerShell reverts back to the default Disable-ScheduledTask cmdlet, it works as expected.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Windows Server 2016 with all most recent patches
Version and build of PowerShell the target node is running
v5.1
Version of the DSC module that was used ('dev' if using current dev branch)
7.1.0.0 and dev
The text was updated successfully, but these errors were encountered: