PowerShell BackupScript Version 1.4 released

I have updated my PowerShell Backup Script and want to provide you the new Release

I have added some New Feature, Staging Folder, Exclude Dirs, 7Zip Support and fixed some Bugs.

Please comment and rate the Script on TechNet

IMPORTANT, the Script is now on GitHub: https://github.com/Seidlm/PowerShell-Backup-Script

The Script

Download is available at TechNet Gallery: http://gallery.technet.microsoft.com/PowerShell-Backup-Script-956f312c

All my TechNet Downloads: 1jrYQoA


Michael Seidl aka Techguy

19 comments to PowerShell BackupScript Version 1.4 released

  • Ken Tole

    is there a way to exclude file types? If this is discussed elsewhere please point me to that blog.

  • Hi, sure, would be an easy one, will be added to the Backlog for the upcoming release

  • c0ntr1but3

    You have an additional „+“ BEFORE the „=“ on line 91. Here:


    It makes the script run but actually fail to do anything useful. When I removed this + everything ran as expected.

    All the best.

  • Hi,
    I’m new in this Powershell stuff. I adapt your code so I can do the backup of our server but the only information that I can see is the log file in the staging folder and in the Destination. I’m not able to retried any information from the files that I want to save. In the destination folder I just can see the log and the backup zip and in this one it’s empty.

  • Per Ljungstrom

    Thank’s for a great tool. Not sure I missed something but I do not see the tool is backing up hidden files like user Appdata folder (using 1.3 now but will update)

  • Per Ljungstrom

    OK, 1.4 seems to be stable for this, I do not see the problem there. I other words – other folders was empty periodically as well in 1.3, not only hidden ones. In 1.4 I have not seen it yet.

  • Bill

    Firstly, thank you for a great script.

    Is there a way when backing up multiple locations to put them in their own folder inside the destination?

    For example:
    Backup c:\users\bill\documents
    Backup c:\users\john\documents

    currently it would place all documents in the s:\backups\ and mix both users documents

    Would like it to take the parent folder name (up 1 level) and use that as the destination. for example:


    This way Bill and John are separate folders and can find files easier.

  • Hi,
    thanks for your comment, I will add this to the feature list for the next release

  • fxgoe53

    I like your script, you have done a great Job.
    After monthes of waiting for AVM supporting SMB V2/3 now i have tested making backup using „backupscript V1.4“.
    I use Windows 10/10Pro V1909 backing up to FRITZ.NAS.
    A first impression it seems to work well, further testing has to be done.
    But there are some issues:
    – counting files works not exactly (i.e. Copied 519 of 481 files with…)
    – counting dataspace works not exactly (i.e. …with 2.176,43 MB of 1.169,58 MB of Files)
    – some files are marked as „ERROR: returned an error an was not copied“ but are correctly copied to media
    – Showing backupduration INFO: Backupduration 0 Hours 6 Minutes and 20 Seconds
    „24.11.2019-15:47:03 – INFO: There are 111152 Files with 303.772,75 MB of Files to copy
    25.11.2019-01:39:37 – INFO: Backupduration 53 Minutes and 10 Seconds“

    best regards

  • Alex Maxwell

    Thank you for this. Its great, I am however trying to add some code to make a change.

    Need to addin where script will check the \Users folder for all listed users.
    Then prompt you to choose which user Dir to Backup.
    Upon choosing, then auto fill in the user for ’seimi“

    Is that possible?

  • Duane Garner

    Great script
    Could you replace 7zip with powershell Compress-Archive to avoid installing 7zip
    Would be greatly appreciated

  • Hi, please see the latest release on github, you can us built in Zip also

  • Andy Stallard

    Hi Michael,
    Your script is very good and I have learned some PS in the process. The only thing I can’t work out is how I can back up a folder and it’s content to a less complex path.

    C:\Data\B\B1\B11\B111 ***I just want this set of folders and subs***

    I would like to be able to save the files to E:\Backups\B_yyyymmdd with the same sub folders but what I get is;
    E:\Backups\Backup_yyyymmdd-Random number\Data\B\B1, etc
    I have figured out how to remove the random numbers but not how to alter the path to how I’d like. Could you offer some advise please, I think I’m missing some vital knowledge as to how the paths are built.

  • Hi, please post your wish at the Github Repo

  • iceman

    hi, how use „Send Email Settings“? I set email from, email to and $EmailSMTP = ’smtp.gmail.com‘ and it not working. How can i use it?

  • Walter

    I ran into an issue that I was able to fix.
    I use PowerShellISE so I can interactively work on scripts and run them easily.

    At the end of the script, I get:

    Exception calling „ReadKey“ with „1“ argument(s): „The method or operation is not implemented.“
    At C:\Users\\Downloads\BackupScript.ps1:356 char:1
    + $x = $host.UI.RawUI.ReadKey(„NoEcho,IncludeKeyDown“)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotImplementedException

    After some searching, I found that ReadKey does not work in PowerShellISE.
    A solution I found that works in PowerShell and PowerShellISE was at
    I added the following function:
    Function pause ($message)
    # Check if running Powershell ISE
    if ($psISE)
    Add-Type -AssemblyName System.Windows.Forms
    Write-Host „$message“ -ForegroundColor Yellow
    $x = $host.ui.RawUI.ReadKey(„NoEcho,IncludeKeyDown“)

    and replaced the following from the original script, not in the function
    $x = $host.ui.RawUI.ReadKey(„NoEcho,IncludeKeyDown“)

    pause „Press any key to close …“

    Works like a charm.

  • Tom

    As the ExcludeDirs are regex parsed I have an issue with directories that contain + characters. I tried to escape them with \ but this did not lead to a success.

    Can you please advise how to properly escape characters?


  • Please get the latest release from GitHub

Leave a Reply