Invoke-command and get-childitem issue

Welcome Forums General PowerShell Q&A Invoke-command and get-childitem issue

  • This topic has 1 reply, 2 voices, and was last updated 4 months ago by
Viewing 1 reply thread
  • Author
    • #179748
      Topics: 2
      Replies: 0
      Points: 24
      Rank: Member


      Scenario 1) I am using Get-childitem command to get the files and folders from the specified path.

      Get-ChildItem -path "C:\Users" -recurse -force

      Above command is providing a satisfactory result. But, I am getting error in Scenario 2.

      Scenario 2) I am using the above command with Invoke-Command and getting an undesired output.

      Invoke-Command -computername "Mycomputer" -scriptblock{Get-ChildItem -path "C:\Users" -recurse -force}


      My findings till now

      When only using scenario 1, By default, the Get-ChildItem cmdlet displays symbolic links to directories found during recursion, but does not recurse into them.

      When I am using the scenario 2, It is not following the Get-ChildItem this behavior and it is doing the recursion.


    • #179853
      Topics: 2
      Replies: 1707
      Points: 3,428
      Helping Hand
      Rank: Community Hero

      and getting an undesired output.

      What does that mean? Do you try to run this command remotely to another computer?

Viewing 1 reply thread
  • The topic ‘Invoke-command and get-childitem issue’ is closed to new replies.