Need help with a line of code

Welcome Forums General PowerShell Q&A Need help with a line of code

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 year, 7 months ago.

  • Author
    Posts
  • #68169

    Participant
    Points: 1
    Rank: Member

    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

    Participant
    Points: 60
    Rank: Member

    I recommend using Robocopy.exe

The topic ‘Need help with a line of code’ is closed to new replies.