Skip to content

How to copy files to all user profiles with PowerShell

Black and White PDQ logo
PDQ|Updated August 13, 2025
Illustration of block with Powershell logo
Illustration of block with Powershell logo

You can copy files in PowerShell using Copy-Item, which lets you automate file transfers to local or remote directories. It’s especially useful when paired with PDQ Connect or PDQ Deploy to target multiple machines.

Let's dig into a few quick examples that show how to copy single files or entire folder structures.

In my examples, I’m copying into the %USERPROFILE%\AppData\Local folder of every user on a computer — but you can modify these scripts to copy any files to any location.

How do I copy a single file with PowerShell? (Get-ChildItem)

$Source = '\\FileShare\FancyConfigurationFiles\Config.xml' $Destination = 'C:\users\*\AppData\Local\' Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force}

How do I copy a folder recursively in PowerShell?

$Source = '\\FileShare\FancyConfigurationFiles\' $Destination = 'C:\users\*\AppData\Local\' Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}

How do I copy only the contents of a folder in PowerShell?

$Source = '\\FileShare\FancyConfigurationFiles\*' $Destination = 'C:\users\*\AppData\Local\' Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}

That’s it. It’s very simple and straightforward. The $Source is the file or folder that you wish to copy. The $Destination is the target folder that you wish to copy to.

Let’s take our script and combine it with PDQ Connect and then PDQ Deploy.

How do I run PowerShell scripts with PDQ Connect?

Need to copy files to remote machines over the internet? PDQ Connect runs PowerShell scripts on any online device with the agent installed — no VPN or network access required. It’s perfect for managing remote devices, satellite offices, or work-from-anywhere fleets.

ConnectIcon CTA

Easily run PowerShell scripts on remote devices

Need to run your awesome PowerShell scripts on remote devices? PDQ Connect can easily execute PowerShell scripts on any managed device with an active internet connection. 

1. Create a package

In the left navigation bar, click Packages. Then, click Create package in the upper right corner.

Screenshot of the PDQ Connect interface with red arrows pointing to the Packages tab and Create package button.

Name your package. Then, click the drop-down menu next to Add install step. Select Add script step.

Screenshot of the Create package window in PDQ Connect showing the name field, the Add install step drop-down menu, and the Add script step option.

Pop in the relevant script, and click Save.

2. Deploy the package

Your new package will now appear in the Packages tab. Check the box next to it, and click Deploy.

Screenshot of the Packages tab in PDQ Connect showing the checkbox next to the newly created package and the Deploy button.

Then, select your target devices or groups and click Deploy.

Screenshot of the Create deployment window in PDQ Connect showing the Search devices and groups field and the Deploy button.

That's all there is to it! With this method, you can deploy PowerShell scripts to on-prem and off-prem endpoints in one fell swoop.

How do I run PowerShell scripts with PDQ Deploy?

Copying files to your machines is easy with PDQ Deploy. While we recommend using the File Copy step for most jobs, PowerShell gives you next-level flexibility — like renaming files, generating content dynamically, or copying based on name, date, etc.

DI WhiteBG

Install (and uninstall) without disruption

Try PDQ Deploy & Inventory — free for 14 days.

Prefer video? Look no further! But if you prefer written instructions, keep reading.

Loading...

Here’s a quick overview of how to deploy your new PowerShell script with PDQ Deploy.

1. Create a package

Creating a package using our new script is super easy. All that you need to do is create a package with an Install Step. Then, you just need to point the Install File to your script.

Copying files with an Install Step and PowerShell script

2. Deploy the package

We can now deploy our new package to any targets. The PowerShell script will run on the targets that you deploy to.

Copying files by deploying a package with a PowerShell script

One thing to keep in mind when using PowerShell with PDQ Deploy: When an install step runs a PowerShell script, it only displays whether or not the script executed successfully. To see more detailed information, you’ll need to examine the output log of your deployment step.

While you’re waiting for your deployments, go get yourself a drink and pat yourself on the back. You just saved yourself a ton of manual effort. Way to go!


Using PowerShell gives you a lot of options for copying files. Give it a shot and have some fun! The sky is the limit for what you can do with a script.

Up for learning more PowerShell tips and tricks? Tune into The PowerShell Podcast. A new episode drops every Monday!

Black and White PDQ logo
PDQ

PDQ is the best way to have healthy, up-to-date machines automatically. Scan your environment for vulnerabilities and streamline your patch management and software deployment processes — whether you manage 15 machines or 15,000.

Related articles