Copy user's items in my documents

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

  • Author
    Posts
  • #90877

    Tony
    Participant

    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
    Keymaster

    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

    Tony
    Participant

    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
    Keymaster

    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

    Tony
    Participant

    Thanks for your help Don.

You must be logged in to reply to this topic.