Solved Unregister-ScheduledTask giving error about non-interactive mode
-
So I have an old scheduled task pushed out that I want to remove, because I am going to replace it.
I pushed it out with via ScreenConnect "Send Command" functionality originally. I think It imported a XML file to create back then.
But I cannot delete it.
@Obsolesce what is my answer? I do not see anything obvious in the docs forUnregister-ScheduedTask
#!ps #maxlength=50000 #timeout=300000 Get-ScheduledTask -TaskName "Weekly Reboot" | Unregister-ScheduledTask
Results in
Exception calling "EndProcessing" with "0" argument(s): "Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available." At line:287 char:17 + $__cmdletization_objectModelWrapper.EndProcessing() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : PSInvalidOperationException
-
@jaredbusch said in Unregister-ScheduledTask giving error about non-interactive mode:
@Obsolesce what is my answer? I do not see anything obvious in the docs for
Unregister-ScheduedTask
Try adding
-Confirm:$false
to it -
@obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:
-Confirm:$false
Well that let it run and gave me a different error. Let me not pipe it and just use -TaskName and see what happens.
-
Nope, that wasn't it.
-
Giving it the explicit wildcard path seems to break -Confirm?
-
@jaredbusch said in Unregister-ScheduledTask giving error about non-interactive mode:
Well that let it run and gave me a different error. Let me not pipe it and just use -TaskName and see what happens.
Try like this:
$task = Get-ScheduledTask -TaskName "Weekly Reboot" $task | Unregister-ScheduledTask -Confirm:$false
That worked for me not so long ago.
-
@obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:
-Confirm:$false
Typos.....
This works...
Unregister-ScheduledTask -TaskName "Weekly Reboot" -Confirm:$false
-
@jaredbusch said in Unregister-ScheduledTask giving error about non-interactive mode:
@obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:
-Confirm:$false
Typos.....
This works...
Unregister-ScheduledTask -TaskName "Weekly Reboot" -Confirm:$false
Ohh, didn't notice the typo lol
-
@obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:
Ohh, didn't notice the typo lol
Funny that. me either......