
Next, we’ll take a quick look at the simple steps involved in copying file to a remote computer using powershell, and then we’ll go into more detail in the next section:
1: Create a New Remote Session | |
2: Verify the Session Properties | |
3: Copy File / Item from One Location to Another | |
4: Verify Whether the File Has Been Copied | |
5: Terminate the Remote Session |
Command-line programs are handy for managing your files and folders on the PC. While there are many command-line functions, the most used one is copying files. With Copy Files, you can copy files from the source to the destination. PowerShell is a more advanced version of the CMD and lets you copy files faster than it. The post from EaseUS details the PowerShell Copy-item cmdlet and how to copy files using PowerShell. Hurry up and learn!
How to Copy File to Remote Computer Using PowerShell
Run PowerShell

Create a Connection to Remote Computer
$Session = New-PSSession -ComputerName “XXX” -Credential “XXX”

Note : You can type Credential Manager in the search box on the taskbar and open it to view credentials.
Verify the Session Properties
Then, you will see the returned command output.
Copy a File
Copy-Item “C:\Folder\test.txt” -Destination “D:\Folder_Copy\” -ToSession $Session

Note : You can also use the FromSession parameter to copy files from the remote computer to local.
Verify Whether the File Has Been Copied
Then, you will see the returned command output.
Terminate the Remote Session
Remove-PSSession -Session $SESSION
Other Commands for Copying Items in Remote Session
Copy a folder to a remote computer | Copy-Item “D:\Folder\” -Destination “C:\Folder_Copy\” -ToSession $Session | No subfolders or files are copied if the Recurse parameter is not used. |
Recursively copy the entire contents of a folder to a remote computer | Copy-Item “D:\Folder\” -Destination “C:\Folder_Copy\” -ToSession $Session -Recurse | Using the Rescue parameter, the subfolder is copied with its file tree intact. |
Copy a file to a remote computer and rename the file | Copy-Item “D:\Folder\test.txt” -Destination “C:\Folder_Copy\test_copy.txt” -ToSession $Session | To rename the file, do not add the / symbol at the end of the file or folder name. |
Copy a file from a remote computer to local | Copy-Item “C:\Folder\test.txt” -Destination “D:\Folder_Copy\” -FromSession $Session | The FromSession parameter is used for the copy command from the remote computer. |
How to Copy Files with PowerShell on Windows 11/10/8/7
The copy-item cmdlet helps you copy files under various situations. Below are some common examples of copying files using PowerShell’s copy item.
Case 1. Copy Files to a Specified Directory
A common situation requiring a copy item is when you want to copy files to a specified directory. We assume you want to copy the mongodb.log.txt files to the Logs directory in the C drive. The steps to do this:
Step 2. Enter the copy-item cmdlet below in the PowerShell and execute it.
- Copy-Item “F:UserDataMyDocumentsmongodb.log.txt” -Destination “C:Logs”

Case 2. Copy Files to an Existing Directory
We have a “C:Logs” directory, and you want to copy its content to the existing “C:BetaDev” directory. The command will not copy the Logs directory but all the subdirectories, including the file trees. The container parameter is True by default, which preserves the directory structure.
- Copy-Item -Path “C:Logs*” -Destination “C:BetaDev” -Recurse

Tip: To include the Logs directory and all the subdirectories and files, remove the * symbol, and you are good to go.
- Copy-Item -Path “C:Logs” -Destination “C:BetaDev” -Recurse
Case 3. Copy File to a New Directory
A frequent situation is when you want to copy files to a new directory. Let’s see an example of copying the “C:Logs” contents to a new directory GameLogs in the “C:Drawings” directory.
If you want to contain the source directory name, you need to copy it to an existing directory as Case 2 or rename the new directory as the source directory.
- Copy-Item -Path “C:Logs” -Destination “C:DrawingsGameLogs” -Recurse

Tip: To copy all the contents of the source, including the tree structures and subdirectories, add * to the command. Replace the “C:Logs” with “C:Logs*”.
Case 4. Copy File to a Specified Directory and Rename It
- Copy-Item “\Server01ShareDesktop-Widget.ps1” -Destination “\Server12ScriptArchiveGet-Widget.ps1.txt”

Upon execution, the PowerShell Copy-item cmdlet will rename the Desktop-Widget.ps1 to Get-Widget.ps1.txt.
Case 5. Copy File to a Remote Computer
So, we will be copying the text.log file from D:MyFolder01 folder to the C:MyFolder01_C folder on the remote system using the session information stored in the $Session variable.
- $Session = New-PSSession -ComputerName “Node01” -Credential “ContosoUser01”
- Copy-Item “D:MyFolder01test.log” -Destination “C:MyFolder01_C” -ToSession $Session

The first command creates a session (connection) with the remote PC; the second helps you copy the files.
Case 6. Copy Folder to Remote Computer
Similarly, you can copy the entire folder to the remote PC using the PowerShell copy folder. Now, we will copy the “D:MyFolder02” folder to “C:MyFolder02_C” directory.
Note: Any files or subfolders are not copied to the remote computer without the recurse parameter.
- $Session = New-PSSession -ComputerName “Node02” -Credential “ContosoUser01”
- Copy-Item “D:MyFolder02” -Destination “C:MyFolder02_C” -ToSession $Session

Case 7. Copy Remote File to Local Computer
The command to copy the “test.log” file from the remote PC directory “C:MyRemoteFile” to the local directory “D:MyLocalFile.”
- $Session = New-PSSession -ComputerName “Node01” -Credential “ContosoUser01”
- Copy-Item “C:MyRemoteFiletest.log” -Destination “D:MyLocalFile” -FromSession $Session

Case 8. Copy Contents of Remote Folder to Local Computer
Assume we want to copy the “C:MyRemoteDataFolder” entire folder in the remote PC to the “D:MyLocalDataFolder” folder.
- $Session = New-PSSession -ComputerName “Node01” -Credential “ContosoUser01”
- Copy-Item “C:MyRemoteDataFolder” -Destination “D:MyLocalDataFolder” -FromSession $Session

Copy Files to Remote Computer with Remote Access Software
Copying files to a remote computer using PowerShell commands can be challenging for those who are not tech-savvy. There are other methods to transfer files remotely, one of which is using the file transfer feature of third-party remote access software.
AirDroid Remote Support serves as a versatile remote access tool for seamless connectivity, instant online communication, and fast file transfer. You can easily transfer files within a chat dialog with the remote computer. Plus, you can explore additional features such as unattended access, black screen mode, and more.

To Wrap Things Up
That comes to an end about how to copy files using PowerShell. Copying files from one point to another using Command-Line tools is handy. PowerShell offers robust copy methods. The post details how to copy files using PowerShell in various situations. We have listed 8 common situations where PowerShell can help you copy files.
Copy commands using command-line tools can potentially cause data loss. The commands, upon failing, result in data ambiguity. Make your data backup now with EaseUS Todo Backup to protect your data. It can help you back up and sync files to different locations and recover them whenever needed. Just download and try it!
Backup Files to Different Locations Instead of Copying
While dealing with data, there can be data loss situations when transferring or copying files. Many command line tools delete the files in the source folder when they try to copy to the destination. Under such circumstances, you may lose data. Accidental deletion of data is common with command line tools when performing copy operations.
Under such circumstances, you can try professional software to help you. A professional tool like EaseUS Todo Backup will secure your data and help you restore it in accidents. It is a free backup and recovery program for Windows PCs.
It can help you automatically back up files or create system images for hard disk failure recovery. With a few clicks, EaseUS creates backups and offers flexible storage options for files, folders, hard drives, and systems. You can store the backups on the PC, external drive, or the cloud. AS one of the best file sync software, it can help you sync files to different locations without copying.
With advanced algorithms and features, you can achieve backup and restoration efficiently. Download EaseUS Todo Backup to protect your data.
Step 1. To initiate a backup, click the Select backup contents option.

Step 2. There are four data backup categories, File, Disk, OS, and Mail, click File.

Step 3. On the left, both local and network files will be shown. You may extend the directory to pick the backup files.


Click Options to encrypt the backup with a password in Backup Options, then click Backup Scheme to specify the backup schedule and start the backup at a certain event. There are also other additional choices you may choose to tailor the backup process to your requirements.

Step 5. The backup may be stored on a local disk, EaseUS’ online service, or NAS.

Step 6. EaseUS Todo Backup enables customers to back up data to a third-party cloud drive as well as its own cloud drive.
If you want to back up data to a cloud drive provided by a third party, choose Local Drive, scroll down to add Cloud Device, and then add and log in to your account.

You can also choose the EaseUS cloud drive. Sign up for an EaseUS Account, then click EaseUS Cloud and log in.

Step 7. Click Backup Now to begin the backup process. The backup job will be presented as a card on the left side of the panel after it has been finished. Right-click the backup job to handle it further.

Can You Copy the File with PowerShell
PowerShell is a powerful command-line tool featuring an incredible shell, scripting languages, and a configuration framework. While PowerShell is available by default on Windows, you can download it for macOS and Linux. The copy-item command helps you copy files from a source to a destination. While copying the files, if the destination has the same file, it will overwrite it.


Powershell Move Files from One Folder to Another
FAQs on Copying Files Using PowerShell
Here are some frequently asked questions about copying files using PowerShell.
1. How to delete a file or folder using PowerShell?
PowerShell offers a Remove-item cmdlet to remove files or folders. You can use the Remove-Item -path C:\Temp\file.txt to remove any file and specify a folder to remove the folder. Additionally, you can use the * symbol to delete multiple files or folders at once.
2. What is the difference between copy and xcopy in PowerShell?
The copy command helps copy files or data in PowerShell, whereas the Xcopy is used to copy multiple files and directory structures from one to another.
3. How to copy multiple files from one folder to another using PowerShell?
To copy multiple files with copy-item, you need to separate all the files with a comma. Take a look at this example to understand better: Copy-Item .\PowerShellcopycommands.jpg,.\multiplefiles.xml -Destination D:\CopyContent\ .
Conclusion
After introducing the operation of using PowerShell to copy files to a remote computer, you will become familiar with Copy-Item command and learn to use it. Alternatively, you can use the file transfer feature of third-party remote access software, which is also a great way to copy files to different locations.



