Copy user's items in my documents

This topic contains 4 replies, has 2 voices, and was last updated by  Tony 4 months, 2 weeks ago.

  • Author
  • #90877


    Hi, I'm looking for the best way to copy over the contents of a users my documents folder from one remote computer to another with the possibility of being able to display with a gridview or output to a csv the files that were copied over. Thanks for any help in advance.

  • #90878

    Don Jones

    Happy to try and help, but I think you'll find a greater response rate if you're asking a concrete technical question. Is there some particular part of the overall task you're stuck on, for example?

  • #90887


    Here is a function I created. How can I get a listing of the files that were copied over so I can display them in a gridview or export to a csv? Thanks for any help.

    Function MYDOCS
    $computernameS = '6yypqg23'
    	$computernameCT = '6WGPQG23'
    	$userid = 'x8921'
    		$source = "\\$computernameS\c$\Users\$userid\documents\*"
    		$destination = "\\$computernameCT\c$\Users\$userid\documents\"
    Copy-Item -Recurse -path $source -destination $destination -Force -Exclude @("my*") | Out-GridView –Title "SOFTWARE INSTALLED CHECK FOR  "
  • #90893

    Don Jones

    Copy-Item doesn't normally produce output, which is why your Grid gets nothing. Add the -PassThru parameter so it'll output file objects for each file it acted on.

  • #90944


    Thanks for your help Don.

You must be logged in to reply to this topic.