Copying a file from one server to another

Welcome Forums General PowerShell Q&A Copying a file from one server to another

This topic contains 2 replies, has 3 voices, and was last updated by

2 years, 3 months ago.

  • Author
  • #61810

    Points: 21
    Rank: Member

    I am a newbie at powershell. I am attempting to copy on file from one server to another server. I found this:

    $Session = new-PSSession -ComputerName $servername -Credential $cred

    Copy-Item -Path $FilePath -Destination -Path $FilePath -ToSession $session

    I am not sure what is suppose to be included in the parameter -Crendenital. What is $cred suppose to hold?


  • #61818

    Points: 1,375
    Helping Hand
    Rank: Community Hero

    Get-Help New-PSSession -Full Most of the Powershell cmdlets are well documented. You should first read the complete help for a cmdlet you're about to use. .... including the examples!

  • #61824

    Points: 0
    Rank: Member

    If both your servers are in the same domain and your account has permissions on both you won't need to use -Credential.
    You'll only need it when copying to a server on which your current account doesn't have permissions 

The topic ‘Copying a file from one server to another’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort