Need help with a line of code

This topic contains 1 reply, has 2 voices, and was last updated by  Sam Boutros 1 year, 1 month ago.

  • Author
  • #68169

    Gerald Church

    Hello all. I am new to powershell but not new to coding, although it has been a few years. I tried to run a script that was designed to copy visible user profile files and folders from one server to another.

    Get-ChildItem "C:\Users\$item\" | Copy-Item -Destination "C:\Temp\users\$item" -Recurse

    My problem is that this somehow grabbed hidden folders like AppData. It is my understanding that the Get-Children cmdlet will only pass information through the pipe that it can see. As you can see, I have no parameters for parsing hidden objects or files through the pipe, and yet it somehow did just that. Am I misunderstanding something or was there something else at work here that caused me problems?

    Thank you so very much for any help you can provide.

  • #68176

    Sam Boutros

    I recommend using Robocopy.exe

You must be logged in to reply to this topic.