The input object cannot be bound to any parameters

Welcome Forums General PowerShell Q&A The input object cannot be bound to any parameters

Viewing 7 reply threads
  • Author
    Posts
    • #197984
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Hi Everyone,

      i am new Powershell, I’m having a small issue. i just need to echo yes to the Remove-Item command. but i am getting “Remove-Item : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
      At line:1 char:12”

      not sure what that means? what am i doing wrong?

       

      code:

      ECHO 'Y' | Remove-Item –path C:\Users\UserName\Desktop\test_DIR\NightlyBK

       

       

       

       

       

       

       

       

       

      • This topic was modified 7 months ago by Fred8103.
    • #198005
      Senior Moderator
      Topics: 9
      Replies: 1265
      Points: 4,582
      Helping Hand
      Rank: Community Hero

      If you are passing input to the confirmation prompt of Remove-Item cmdlet, then what you need here is -Force switch.

      More information here in

      Get-Help Remove-Item -Parameter Force
      
      • This reply was modified 7 months ago by kvprasoon.
    • #198017
      Participant
      Topics: 13
      Replies: 1691
      Points: 2,882
      Helping Hand
      Rank: Community Hero

      That’s not really what the pipeline is for, recommend that you get a book and understand the basic concepts. Adding a -Force or -Confirm:$false should override the prompt:

      PS C:\WINDOWS\system32> Remove-Item -Force -Confirm:$false
      
    • #198029
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      ah, ok. thanks i will look into it!

    • #198176
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      pipeline

      Hi Rob, I appreciate your feedback. I am currently reading many different articles and watching many videos on the subject. As mentioned in my original post I’m new to this, hence why came to a forum with experts looking for advice. i am struggling with the pipeline concept. In my mind it would seem an echo yes would go before the command to delete the directory, since you’re going to be prompted for a yes or no responce. And since the pipeline just connects the output of the first into the input of the second, conceptually I thought this made sense.

      But as I pointed out my post (I’m doing something wrong) and looking for expertise in helping me understand where I’ve made my mistake. I appreciate your feedback, but next time could you add some recommended reading.  Again I’m new to power shell commands, I’m just struggling with this one very simple command. Once I get it figured out I will continue researching more power shell until I get stuck on the next one.

      I assume forms like this are meant to help people like me who are not as proficient as people like you.

      Again thanks for the feedback

      • This reply was modified 6 months, 4 weeks ago by Fred8103.
    • #198233
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      thanks guys,

      with both your help, i got it working. The only extra thing I need to do outside of your advice was to add the Recurse switch to the command to clear out the sub items.

      Remove-Item –path C:\Users\Username\Desktop\test_DIR\NightlyBK -Force –recurse

    • #198539
      Participant
      Topics: 0
      Replies: 1
      Points: 5
      Rank: Member

      Maybe this could help

      Understanding Streams, Redirection, and Write-Host in PowerShell

      and look for Learning Powershell in a month of Lunches. The Book, not just the Videos. It’s great for a solid foundation

    • #198608
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Maybe this could help

      Understanding Streams, Redirection, and Write-Host in PowerShell

      <iframe class=”wp-embedded-content” title=”” src=”https://devblogs.microsoft.com/scripting/understanding-streams-redirection-and-write-host-in-powershell/embed/#?secret=dU3diphXqF&#8221; width=”600″ height=”325″ frameborder=”0″ marginwidth=”0″ marginheight=”0″ scrolling=”no” sandbox=”allow-scripts” data-secret=”dU3diphXqF” data-mce-fragment=”1″></iframe>

      and look for Learning Powershell in a month of Lunches. The Book, not just the Videos. It’s great for a solid foundation

       

      this is great, thanks!

Viewing 7 reply threads
  • The topic ‘The input object cannot be bound to any parameters’ is closed to new replies.