Skip to content

How to copy files to all user profiles with PowerShell

Black and White PDQ logo
Kris Powell|Updated February 11, 2025
Illustration of block with Powershell logo
Illustration of block with Powershell logo

If you've ever used a computer, then you probably already know how to copy files. Copying files with PowerShell, however, makes things a great deal more interesting and fun.

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.

Copy a single file (Get-ChildItem)

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

Copy a directory and its contents recursively

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

Copy the contents of a directory recursively

$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 Deploy.

DI WhiteBG

Install (and uninstall) without disruption

Try PDQ Deploy & Inventory — free for 14 days.

Using PDQ Deploy to run PowerShell scripts remotely

Copying files to all your machines is a piece of cake with PDQ Deploy. We normally recommend using our File Copy step for copying files to your targets.

The wonderful thing about using a PowerShell script is that it allows you to take copying files to a whole new level.

  • Renaming files after copying? Yep.

  • Dynamic creation of files? Yep.

  • Copying files based on name, date, etc.? Double yep.

If you can dream it up, you can probably do it with PowerShell. Get creative!

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. 

How to use PowerShell with PDQ Deploy

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

  1. Create a package

  2. Add an install step to the package

  3. Add your PowerShell script to your install step

  4. Deploy your package to your computers

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

Loading...

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

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!

Extra features

Adding machines manually is great for quick deployments. For more flexibility and power, you can team up with PDQ Inventory. You can make dynamic collections to deploy packages to targets based off of any number of criteria.

For example, you could create collections based on operating system, installed applications, amount of RAM, etc. There are so many possibilities! You can use your own custom fields for data unique to your organization. You can even set up packages to run on a schedule, automatically retry failed machines, email you the results, use Wake-On-LAN, and much more.


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
Kris Powell

Kris was an employee at PDQ.

Related articles