ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Solved Unregister-ScheduledTask giving error about non-interactive mode

    IT Discussion
    powershell scheduled tasks
    2
    9
    330
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBusch
      JaredBusch last edited by JaredBusch

      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 for Unregister-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
      

      b095d0eb-2c6e-4bde-8b70-5f8b479f01ab-image.png

      Obsolesce 1 Reply Last reply Reply Quote 0
      • Obsolesce
        Obsolesce @JaredBusch last edited by Obsolesce

        @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

        JaredBusch 1 Reply Last reply Reply Quote 1
        • Obsolesce
          Obsolesce @JaredBusch last edited by Obsolesce

          @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

          JaredBusch 1 Reply Last reply Reply Quote 1
          • JaredBusch
            JaredBusch @Obsolesce last edited by

            @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.
            4ebbabe4-f5c3-45dc-b1ca-05737e62ba77-image.png

            Obsolesce 1 Reply Last reply Reply Quote 0
            • JaredBusch
              JaredBusch last edited by

              Nope, that wasn't it.
              96639ac0-adf6-413e-847b-2b1c9c852db7-image.png

              1 Reply Last reply Reply Quote 0
              • JaredBusch
                JaredBusch last edited by

                Giving it the explicit wildcard path seems to break -Confirm?
                57f3a139-5411-4bf8-840b-8e31901e241f-image.png

                1 Reply Last reply Reply Quote 0
                • Obsolesce
                  Obsolesce @JaredBusch last edited by

                  @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.

                  JaredBusch 1 Reply Last reply Reply Quote 1
                  • JaredBusch
                    JaredBusch @Obsolesce last edited by

                    @obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:

                    -Confirm:$false

                    Typos.....

                    This works...

                    Unregister-ScheduledTask -TaskName "Weekly Reboot" -Confirm:$false
                    
                    Obsolesce 1 Reply Last reply Reply Quote 2
                    • Obsolesce
                      Obsolesce @JaredBusch last edited by

                      @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

                      JaredBusch 1 Reply Last reply Reply Quote 0
                      • JaredBusch
                        JaredBusch @Obsolesce last edited by

                        @obsolesce said in Unregister-ScheduledTask giving error about non-interactive mode:

                        Ohh, didn't notice the typo lol

                        Funny that. me either......

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post