# Copy files to a remote server

**URL:** <https://forums.powershell.org/t/copy-files-to-a-remote-server/18670>\
**Category:** PowerShell Help\
**Created:** [February 24, 2022, 3:31am UTC](https://forums.powershell.org/t/copy-files-to-a-remote-server/18670 "2022-02-24T03:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@Ben](https://forums.powershell.org/u/Ben)\
**Post date:** [February 24, 2022, 3:31am UTC](https://forums.powershell.org/t/copy-files-to-a-remote-server/18670/1 "2022-02-24T03:31:38Z")

</div>

Hi, I need to copy files to 100 servers. What should I do? \* An error is as follows:  
Copy-Item : Cannot convert ‘System.Object’ to the type ‘System.Management.Automation.Runspaces.PSSession’ required by parameter ‘ToSession’. Speci  
fied method is not supported.

```auto
$s=New-PSSession -ComputerName (Import-Csv c:\1.csv).hostname
   Copy-Item -Path C:\BESRemove.exe -Destination C:\BESRemove.exe -Recurse -Force -ToSession $s
   Copy-Item -Path C:\treesizefree.exe -Destination C:\treesizefree.exe -Recurse -Force -ToSession $s
  

```

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [February 24, 2022, 9:00am UTC](https://forums.powershell.org/t/copy-files-to-a-remote-server/18670/2 "2022-02-24T09:00:01Z")

</div>

`-ToSession` accepts only single session, here you have multiple sessions, hence it is failing. You will have to iterate with each session object to do the copy operation.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:18pm UTC](https://forums.powershell.org/t/copy-files-to-a-remote-server/18670/3 "2024-05-16T20:18:17Z")

</div>


