{"id":6962,"date":"2019-11-12T11:35:08","date_gmt":"2019-11-12T16:35:08","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=6962"},"modified":"2019-11-12T11:35:16","modified_gmt":"2019-11-12T16:35:16","slug":"creating-a-powershell-backup-system-part-4","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","title":{"rendered":"Creating a PowerShell Backup System &#8211; Part 4"},"content":{"rendered":"<p>We're almost to the end of my PowerShell backup system. <a title=\"Read Part 3 if you missed it.\" href=\"https:\/\/jdhitsolutions.com\/blog\/?p=6955\" target=\"_blank\" rel=\"noopener noreferrer\">Last time<\/a> I showed you how I handle my daily incremental backups. Today I figured I should circle back and go over how I handle weekly full backups. Remember, I am only concerned about backing up a handful of critical folders. I've saved that list to a file which I can update at any time should I need to start backing up something else.<\/p>\n<h2>The PowerShell Scheduled Job<\/h2>\n<p>Let's start by looking at the code I use to setup a PowerShell scheduled job that runs every Friday night 10:00PM. I save the code in a script file so I can recreate the job if I need to.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#create weekly full backups\n\n$trigger = New-JobTrigger -At 10:00PM -DaysOfWeek Friday -WeeksInterval 1 -Weekly\n$jobOpt = New-ScheduledJobOption -RunElevated -RequireNetwork -WakeToRun\n\n$params = @{\n FilePath = \"C:\\scripts\\WeeklyFullBackup.ps1\"\n Name = \"WeeklyFullBackup\" \n Trigger = $trigger \n ScheduledJobOption = $jobOpt \n MaxResultCount = 5 \n Credential = \"$env:computername\\jeff\"\n}\nRegister-ScheduledJob @params\n<\/pre>\n<p>One thing I want to point out is that instead of defining a scriptblock I'm specifying a file path.&nbsp; This way I can adjust the script all I want without having to recreate or modify the scheduled job. Granted, since I have this in a script file it isn't that difficult but I don't like having to touch something that is working if I don't have to. I'm including a credential because part of my task will include copying the backup archive files to my Synology NAS device.<\/p>\n<h2>The Backup Control Script<\/h2>\n<p>The script that the scheduled job invokes is pretty straightforward.&nbsp; It has to process the list of directories and backup each folder to a RAR file.&nbsp; I'm using WinRar for my archiving solution. You can substitute your own backup or archiving code. I have some variations I'll save in future articles. Each archive file is then moved to my NAS device. Now that I think of it, I should probably add some code to also send a copy to one of my cloud drives like OneDrive.<\/p>\n<p>Here's the complete script.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#requires -version 5.1\n\n[cmdletbinding(SupportsShouldProcess)]\nParam()\n\nIf (Test-Path -Path c:\\scripts\\mybackupPaths.txt) {\n\n    #filter out blanks and commented lines\n    $paths = Get-Content c:\\scripts\\mybackupPaths.txt | Where-Object { $_ -match \"(^[^#]\\S*)\" -and $_ -notmatch \"^\\s+$\" }\n   \n    #import my custom module\n    Import-Module C:\\scripts\\PSRAR\\Dev-PSRar.psm1 -force\n   \n    $paths | ForEach-Object {\n\n        if ($pscmdlet.ShouldProcess($_)) {\n            Try {\n                #invoke a control script using my custom module\n                C:\\scripts\\RarBackup.ps1 -Path $_ -Verbose -ErrorAction Stop\n                $ok = $True\n            }\n            Catch {\n                $ok = $False\n                Write-Warning $_.exception.message\n            }\n        }\n\n        #clear corresponding incremental log files\n        $name = ((Split-Path $_ -Leaf).replace(' ', ''))\n        #specify the directory for the CSV log files\n        $log = \"D:\\Backup\\{0}-log.csv\" -f $name\n\n        if ($OK -AND (Test-Path $log) -AND ($pscmdlet.ShouldProcess($log, \"Clear Log\"))) {\n            Remove-Item -path $log\n        }\n    }\n}\nelse {\n    Write-Warning \"Failed to find c:\\scripts\\mybackupPaths.txt\"\n}\n<\/pre>\n<p>The RarBackup.ps1 script is what does the actual archiving and copying to the NAS.<\/p>\n<h2>The Backup Script<\/h2>\n<p>This file invokes my RAR commands to create the archive and copy it to the NAS. I have code using Get-FileHash to validate the file copy is successful.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#requires -version 5.1\n\n[cmdletbinding(SupportsShouldProcess)]\nParam(\n    [Parameter(Mandatory)]\n    [ValidateScript( { Test-Path $_ })]\n    [string]$Path,\n    [ValidateScript( { Test-Path $_ })]\n    #my temporary work area with plenty of disk space\n    [string]$TempPath = \"D:\\Temp\",\n    [ValidateSet(\"FULL\", \"INCREMENTAL\")]\n    [string]$Type = \"FULL\"\n)\n\nWrite-Verbose \"[$(Get-Date)] Starting $($myinvocation.MyCommand)\"\nif (-Not (Get-Module Dev-PSRar)) {\n    Import-Module C:\\scripts\\PSRAR\\Dev-PSRar.psm1 -force\n}\n\n#replace spaces in path names\n$name = \"{0}_{1}-{2}.rar\" -f (Get-Date -format \"yyyyMMdd\"), (Split-Path -Path $Path -Leaf).replace(' ', ''), $Type\n$target = Join-Path -Path $TempPath -ChildPath $name\n\n#I have hard coded my NAS backup. Would be better as a parameter with a default value.\n$nasPath = Join-Path -Path \\\\DS416\\backup -ChildPath $name\nWrite-Verbose \"[$(Get-Date)] Archiving $path to $target\"\n\nif ($pscmdlet.ShouldProcess($Path)) {\n    #Create the RAR archive -you can use any archiving technique you want\n    Add-RARContent -path $Path -Archive $target -CompressionLevel 5 -Comment \"$Type backup of $(($Path).ToUpper()) from $env:Computername\"\n\n    Write-Verbose \"[$(Get-Date)] Copying $target to $nasPath\"\n    Try {\n        #copy the RAR file to the NAS for offline storage\n        Copy-Item -Path $target -Destination $NASPath -ErrorAction Stop\n    }\n    Catch {\n        Write-Warning \"Failed to copy $target. $($_.exception.message)\"\n        Throw $_\n    }\n    #verify the file was copied successfully\n    Write-Verbose \"[$(Get-Date)] Validating file hash\"\n\n    $here = Get-FileHash $Target\n    $there = Get-FileHash $nasPath\n    if ($here.hash -eq $there.hash) {\n        #delete the file if the hashes match\n        Write-Verbose \"[$(Get-Date)] Deleting $target\"\n        Remove-Item $target\n    }\n    else {\n        Write-Warning \"File hash difference detected.\"\n        Throw \"File hash difference detected\"\n    }\n}\n\nWrite-Verbose \"[$(Get-Date)] Ending $($myinvocation.MyCommand)\"\n\n#end of script file\n<\/pre>\n<p>Structurally, I could have put all of this code into a single PowerShell script. But I like a more modular approach so that I can re-use scripts or commands. Or if I need to revise something I don't have to worry about breaking a monolithic script.<\/p>\n<h2>Reporting<\/h2>\n<p>The last step I want to share is reporting. I don't worry too much about checking the results of scheduled jobs. All I need to do is check my backup folder for my archive files. Because my backup archives follow a standard naming convention, I can use regular expressions to match on the file name. I use this control script to see my backup archives.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\"># requires -version 5.1\n\n[cmdletbinding()]\nParam(\n    [Parameter(Position = 0, HelpMessage = \"Enter the path with extension of the backup files.\")]\n    [ValidateNotNullOrEmpty()]\n    [ValidateScript( { Test-Path $_ })]\n    [string]$Path = \"\\\\ds416\\backup\",\n    [Parameter(HelpMessage = \"Get backup files only with no formatted output.\")]\n    [Switch]$Raw\n)\n\n&lt;#\n A regular expression pattern to match on backup file name with named captures\n to be used in adding some custom properties. My backup names are like:\n\n  20191101_Scripts-FULL.rar\n  20191107_Scripts-INCREMENTAL.rar\n\n  #&gt;\n[regex]$rx = \"^20\\d{6}_(?&lt;set&gt;\\w+)-(?&lt;type&gt;\\w+)\\.rar$\"\n\n&lt;#\nI am doing so 'pre-filtering' on the file extension and then using the regular\nexpression filter to fine tune the results\n#&gt;\n$files = Get-ChildItem -path $Path -filter *.rar | Where-Object { $rx.IsMatch($_.name) }\n\n#add some custom properties to be used with formatted results based on named captures\nforeach ($item in $files) {\n    $setpath = $rx.matches($item.name).groups[1].value\n    $settype = $rx.matches($item.name).groups[2].value\n\n    $item | Add-Member -MemberType NoteProperty -Name SetPath -Value $setpath\n    $item | Add-Member -MemberType NoteProperty -Name SetType -Value $setType\n}\n\nif ($raw) {\n    $Files\n}\nelse {\n    $files | Sort-Object SetPath, SetType, LastWriteTime | Format-Table -GroupBy SetPath -Property LastWriteTime, Length, Name\n}\n<\/pre>\n<p>The default behavior is to show formatted output.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" title=\"my backup archive files\" style=\"display: inline; background-image: none;\" alt=\"my backup archive files\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png\" width=\"839\" height=\"772\" border=\"0\"><\/a><\/p>\n<p>Normally, you would never want to include Format cmdlets in your code. But in this case, I am using a script to give me a result I want without having to do a lot of typing. That's why this is a script and not a function. With this in mind, the control script also has a -Raw parameter which writes the file objects to the pipeline.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-11.png\"><img loading=\"lazy\" decoding=\"async\" title=\"raw backup files\" style=\"display: inline; background-image: none;\" alt=\"raw backup files\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-11.png\" width=\"1028\" height=\"630\" border=\"0\"><\/a><\/p>\n<p>My weekly backup script deletes the incremental files. For now, I will manually remove older full backups. Although I could add code to only keep the last 5 full backups.<\/p>\n<p>This system is still new and I'm constantly tweaking and adding new tools. I don't feel that I can turn this into a complete, standalone PowerShell module given that I have written my code for me and my network. But there should be enough of my code that you can utilize to create your own solution. I have some other backup ideas and techniques I'll share with you another time. In the mean time, I'd love to hear what you think about all of this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;re almost to the end of my PowerShell backup system. Last time I showed you how I handle my daily incremental backups. Today I figured I should circle back and go over how I handle weekly full backups. Remember, I am only concerned about backing up a handful of critical folders. I&#8217;ve saved that list&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Just posted: Creating a #PowerShell Backup System - Part 4","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[201,534,540],"class_list":["post-6962","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-backup","tag-powershell","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-12T16:35:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-12T16:35:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Creating a PowerShell Backup System &#8211; Part 4\",\"datePublished\":\"2019-11-12T16:35:08+00:00\",\"dateModified\":\"2019-11-12T16:35:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/\"},\"wordCount\":673,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb-10.png\",\"keywords\":[\"Backup\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/\",\"name\":\"Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb-10.png\",\"datePublished\":\"2019-11-12T16:35:08+00:00\",\"dateModified\":\"2019-11-12T16:35:16+00:00\",\"description\":\"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb-10.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb-10.png\",\"width\":839,\"height\":772},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6962\\\/creating-a-powershell-backup-system-part-4\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a PowerShell Backup System &#8211; Part 4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator","description":"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","og_locale":"en_US","og_type":"article","og_title":"Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator","og_description":"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","og_site_name":"The Lonely Administrator","article_published_time":"2019-11-12T16:35:08+00:00","article_modified_time":"2019-11-12T16:35:16+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Creating a PowerShell Backup System &#8211; Part 4","datePublished":"2019-11-12T16:35:08+00:00","dateModified":"2019-11-12T16:35:16+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/"},"wordCount":673,"commentCount":5,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png","keywords":["Backup","PowerShell","Scripting"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","name":"Creating a PowerShell Backup System - Part 4 &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png","datePublished":"2019-11-12T16:35:08+00:00","dateModified":"2019-11-12T16:35:16+00:00","description":"I wrap up my series on creating a PowerShell backup system be explaining how I handle my full backups plus a reporting control script.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-10.png","width":839,"height":772},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Creating a PowerShell Backup System &#8211; Part 4"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":6955,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6955\/creating-a-powershell-backup-system-part-3\/","url_meta":{"origin":6962,"position":0},"title":"Creating a PowerShell Backup System &#8211; Part 3","author":"Jeffery Hicks","date":"November 11, 2019","format":false,"excerpt":"Let's continue exploring my PowerShell based backup system. If you are just jumping in, be sure to read part 1 and part 2 first. At the end of the previous article I have set up a scheduled job that is logging changed files in key folders to CSV files. The\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-9.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-9.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-9.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-9.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6905,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/","url_meta":{"origin":6962,"position":1},"title":"Creating a PowerShell Backup System","author":"Jeffery Hicks","date":"November 7, 2019","format":false,"excerpt":"If you follow me on Twitter, you know that I have a monthly tweet reminder about running and testing backups. I have to say that the concept of a backup is different today than it was when I started in IT. Now we have cheap disk storage and cloud services.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7081,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7081\/managing-my-powershell-backup-files\/","url_meta":{"origin":6962,"position":2},"title":"Managing My PowerShell Backup Files","author":"Jeffery Hicks","date":"December 12, 2019","format":false,"excerpt":"Last month I started a project to begin backing up critical folders. This backup process is nothing more than another restore option should I need it. Still, it has been running for over a month and I now have a number of full backup files. I don't need to keep\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7422,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7422\/backing-up-windows-terminal-settings-with-powershell\/","url_meta":{"origin":6962,"position":3},"title":"Backing Up Windows Terminal Settings with PowerShell","author":"Jeffery Hicks","date":"April 30, 2020","format":false,"excerpt":"I've been a big fan of Windows Terminal since the very beginning. In fact, I've been using it for so long that I've been moving along profile settings that have long since changed. I didn't bother to update my settings. Part of the challenge is that the app will update\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6910,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6910\/creating-a-powershell-backup-system-part-2\/","url_meta":{"origin":6962,"position":4},"title":"Creating a PowerShell Backup System Part 2","author":"Jeffery Hicks","date":"November 8, 2019","format":false,"excerpt":"Yesterday I began a series of articles documenting my PowerShell based backup system. The core of my system is using the System.IO.FileSystemWatcher as a means to track daily file changes so I know what to backup. However there are some challenges. I need to watch several folders, I need to\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"Checking pending files","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-5.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-5.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3740,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3740\/infoworld-automate-live-vm-export\/","url_meta":{"origin":6962,"position":5},"title":"InfoWorld: Automate Live VM Export","author":"Jeffery Hicks","date":"March 13, 2014","format":false,"excerpt":"This is kinda cool, but I got published in InfoWorld, in a roundabout manner. J. Peter Bruzzese writes a column for InfoWorld on enterprise Windows. His latest column is about exporting Hyper-V virtual machines using PowerShell. In Windows Server 2012 R2 (and Windows 8.1) you can export a virtual machine\u2026","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"infoworld","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/03\/infoworld.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=6962"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6962\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=6962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=6962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=6962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}