How to Copy Files Using BITS and PowerShell

BITS PowerShel

Using BITS with PowerShell is a great way to copy files because you get the best of both worlds. BITS doesn’t care if the network connection drops or if the machine restarts, it will just wait patiently until it can connect again and start from where it left off. So you can leave the job to do it’s thing and know that the file will get there in the end. This is especially useful if you have to regularly upload logs from a client/laptop because the job will just keep going until the file is transferred.

By leveraging BITS with PowerShell, you’re able to seamlessly integrate BITS transfers within your PowerShell scripts which makes for a pretty powerful combination!

Creating a BITS job with PowerShell

To create a BITS job with PowerShell you just need to use the Start-BITSTransfer cmdlet and give it the source and destination. This will create the job and start copying the file right away.


Are you an IT pro ready to take your career to the next level? If so, join our contributor program! You don't have to be an expert presenter, a Microsoft MVP or even have a blog. We want your knowledge! You will be coached on presentation skills, become a member of our awesome community and get paid some nice side hustle income every, single month! Sign up today!.

The -Asynchronous switch makes it run in the background so you don’t need to watch the progress bar. You can leave this off if you want to watch it run, but it’s perfect for when you are scheduling a copy job etc.

If you are copying lots of files it’s worth thinking about the -DisplayName switch so that you can spot the job in the list.

Finding BITS jobs with PowerShell

To find BITS jobs, just use the Get-BitsTransfer PowerShell cmdlet. Notice the DisplayName of the job is there because we specified it with the switch.

And if we pipe this into Select * it gives you all the attributes for the job.

Notice this shows the status of the BITS job and the BytesTotal/BytesTransferred. In this case, the BITS job has finished, but the job still exists in the list. This means that we can still see all the details of the jobs and we can even add more files to it and it will start transferring those as well. We do this by piping the job into the Add-BitsFile PowerShell cmdlet, and specifying the files we want to add.

Pausing and restarting a BITS job with PowerShell

If we need to pause the job halfway through and start it up later we can use the Suspend-BitsTransfer and Resume-BitsTransfer cmdlets.

Removing BITS jobs with PowerShell

If we want to close down the jobs once they are done with, we can use the Complete-BitsTransfer cmdlet and they will disappear from the list once they are complete. Either pipe the job to it or the list of jobs.

If you are often uploading large log files or client logs, using PowerShell and BITS can be a great way to do this!

I’m a freelance SysAdmin with 20 years experience in IT. My focus is mainly on PowerShell, Automation and Azure Infrastructure. I’ve always had a fascination for anything techie and love learning and sharing that knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.