{"id":6905,"date":"2019-11-07T10:51:56","date_gmt":"2019-11-07T15:51:56","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=6905"},"modified":"2019-11-07T10:52:03","modified_gmt":"2019-11-07T15:52:03","slug":"creating-a-powershell-backup-system","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/","title":{"rendered":"Creating a PowerShell Backup System"},"content":{"rendered":"<p>If you follow me on <a title=\"follow me if you wish\" href=\"https:\/\/twitter.com\/jeffhicks\" target=\"_blank\" rel=\"noopener noreferrer\">Twitter<\/a>, 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. In some ways, our data is constantly being backed up. This is true even for me. I use a number of cloud services to save and synchronize data across multiple devices. For the longest time, I didn't think about any sort of formal backup strategy. But perhaps I'm getting a bit more cautious in my old age. Or maybe paranoid. Lately, I've started worrying about <em>something<\/em> happening locally that commits <strong>bad<\/strong> data to to my cloud services. It doesn't really matter what causes the problem only that I might end up synching corrupted or bad data to the cloud. I need to be better prepared. Because I'm a PowerShell guy, I need a PowerShell backup system.<\/p>\n<p>I'd like to think I take reasonable precautions. I run <a href=\"https:\/\/www.eset.com\/us\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESET Internet Security<\/a> on my systems. I visit dubious web sites. I keep up to date with patches and updates. I've even setup backup of key folders using Windows 10 tools. However, I like having options. Over the last week of so I've been building a PowerShell-based backup solution. Perhaps this isn't something you need, but you might find some of the techniques I'm using helpful in your own related work.<\/p>\n<h2>Baseline Backups<\/h2>\n<p>My backup approach follows a traditional model of a full backups followed by daily incremental backups. I have a <a title=\"learn more about the DS416Slim\" href=\"https:\/\/www.synology.com\/en-global\/products\/DS416slim\" target=\"_blank\" rel=\"noopener noreferrer\">Synology NAS device<\/a> on my local network that I already use as a backup source. I created archive files of key folders using a naming convention of <strong>YearMonthDay_identifier_FULL<\/strong>. It doesn't really matter what tool you use to create the archive. I use WinRar so I end up with a file like <em>20191101_scripts-FULL.rar<\/em>. I started out trying to use<strong> Compress-Archive<\/strong> but it has a known limitation when it comes to hidden files and folders. And since I wanted to backup my git projects as well, I had to turn to something else. I suppose I could skip these items since I push to GitHub. But not every local project is on GitHub. Regardless, I may have other work to backup that might include a hidden file so Compress-Archive is not an option. In a future post, I'll share the PowerShell code I'm using to run WinRar.<\/p>\n<h2>Watching For Files<\/h2>\n<p>The major step in my backup process is deciding what files to backup incrementally. For that I decided to turn to the .NET System.IO.FileSystemWatcher and an event subscription. Here's a sample of how this works. First, I create an instance of the FileSystemWatcher.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$path=\"C:\\work\\\"\n\n#define the watcher object\n$watcher=[System.IO.FileSystemWatcher]($path)\n$watcher.IncludeSubdirectories = $True\n#enable the watcher\n$watcher.EnableRaisingEvents=$True\n<\/pre>\n<p>Be sure to enable the watcher to watch for subfolders. I missed that the first time and couldn't figure out why not all my changes were being detected.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.png\" alt=\"the file system watcher\" width=\"1021\" height=\"421\" border=\"0\" \/><\/a><\/p>\n<p>You can see that by default this will watch for all files (*.*) which is fine for my purposes. Eventually you'll see how I perform additional filtering.\u00a0 Next I create the event subscriber using <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=135244\" target=\"_blank\" rel=\"noopener noreferrer\">Register-ObjectEvent<\/a>.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$params = @{\n InputObject = $watcher \n Eventname = \"Changed\" \n SourceIdentifier = \"WorkChange\" \n MessageData = \"A file was created or changed\" \n}\n\nRegister-ObjectEvent @params\n<\/pre>\n<p>The possible options for EventName when using the FileSystemWatcher are Changed,Created, and Deleted. Technically, there is a Renamed event, but I've never worked with that. Use the <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=135155\" target=\"_blank\" rel=\"noopener noreferrer\">Get-EventSubscriber<\/a> cmdlet to view the subscription.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-1.png\" alt=\"the PowerShell event subscriber\" width=\"847\" height=\"395\" border=\"0\" \/><\/a><\/p>\n<p>When I created this subscription, every time a file is changed (or created) in C:\\Work, I'll get an event. You can see these events with <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113453\" target=\"_blank\" rel=\"noopener noreferrer\">Get-Event<\/a>.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-2.png\" alt=\"a PowerShell event\" width=\"1018\" height=\"467\" border=\"0\" \/><\/a><\/p>\n<p>Information about the file is stored in the SourceEventArgs property.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-3.png\" alt=\"event details\" width=\"675\" height=\"314\" border=\"0\" \/><\/a><\/p>\n<p>If I needed to watch C:\\Work for backup, I would know to include this file.<\/p>\n<h2>Getting Results<\/h2>\n<p>As long as this PowerShell session is running the event subscriber will capture changes. Later in the day, I can get a list of all files ready to be backed up.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">(Get-Event).sourceEventArgs.fullpath | Select-Object -unique | Where-Object { Test-Path $_}\n<\/pre>\n<p>I'm filtering for unique paths because sometimes a file change might fire multiple events for the same file. Or I might change a file several times throughout the day. I might also delete a file which is why I'm testing the path.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-4.png\" alt=\"processing SourceEventArgs\" width=\"1028\" height=\"252\" border=\"0\" \/><\/a><\/p>\n<p>I can funnel these files to my backup routine to create an incremental archive.<\/p>\n<h2>Next Steps<\/h2>\n<p>But there are limitations with what I've demonstrated thus far. If I close PowerShell, I lose the event subscriber. By the way, you can use <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=135269\" target=\"_blank\" rel=\"noopener noreferrer\">Unregister-Event<\/a> to manually remove the event subscriber. I also have multiple folders I want to monitor. Next time, I'll show you how I setup a PowerShell scheduled job to handle my daily monitoring needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. In some ways, our data&#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":"New on the blog: Creating a #PowerShell Backup System","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-6905","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 &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.\" \/>\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\/6905\/creating-a-powershell-backup-system\/\" \/>\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 &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-07T15:51:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-07T15:52:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Creating a PowerShell Backup System\",\"datePublished\":\"2019-11-07T15:51:56+00:00\",\"dateModified\":\"2019-11-07T15:52:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/\"},\"wordCount\":789,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb.png\",\"keywords\":[\"Backup\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/\",\"name\":\"Creating a PowerShell Backup System &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb.png\",\"datePublished\":\"2019-11-07T15:51:56+00:00\",\"dateModified\":\"2019-11-07T15:52:03+00:00\",\"description\":\"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image_thumb.png\",\"width\":1021,\"height\":421},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6905\\\/creating-a-powershell-backup-system\\\/#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\"}]},{\"@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 &#8226; The Lonely Administrator","description":"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.","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\/6905\/creating-a-powershell-backup-system\/","og_locale":"en_US","og_type":"article","og_title":"Creating a PowerShell Backup System &#8226; The Lonely Administrator","og_description":"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/","og_site_name":"The Lonely Administrator","article_published_time":"2019-11-07T15:51:56+00:00","article_modified_time":"2019-11-07T15:52:03+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Creating a PowerShell Backup System","datePublished":"2019-11-07T15:51:56+00:00","dateModified":"2019-11-07T15:52:03+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/"},"wordCount":789,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.png","keywords":["Backup","PowerShell","Scripting"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/","name":"Creating a PowerShell Backup System &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.png","datePublished":"2019-11-07T15:51:56+00:00","dateModified":"2019-11-07T15:52:03+00:00","description":"The start of a series of articles demonstrating how I built a PowerShell-based backup system for critical files employing the System.IO.FileSystemWatcher.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb.png","width":1021,"height":421},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6905\/creating-a-powershell-backup-system\/#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"}]},{"@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":7081,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7081\/managing-my-powershell-backup-files\/","url_meta":{"origin":6905,"position":0},"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":2566,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2566\/importing-hyper-v-vm-from-a-powershell-backup\/","url_meta":{"origin":6905,"position":1},"title":"Importing Hyper-V VM from a PowerShell Backup","author":"Jeffery Hicks","date":"November 5, 2012","format":false,"excerpt":"My Petri article this week is on importing Hyper-V VMs from a backup. http:\/\/bit.ly\/PRE0pk I have many more articles on Hyper-V on Windows 8 on the site as well. You can find all of my recent posts here.","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":6962,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6962\/creating-a-powershell-backup-system-part-4\/","url_meta":{"origin":6905,"position":2},"title":"Creating a PowerShell Backup System &#8211; Part 4","author":"Jeffery Hicks","date":"November 12, 2019","format":false,"excerpt":"We'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\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-11.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-11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-11.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-11.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6955,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6955\/creating-a-powershell-backup-system-part-3\/","url_meta":{"origin":6905,"position":3},"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":6996,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6996\/powershell-controller-scripts\/","url_meta":{"origin":6905,"position":4},"title":"PowerShell Controller Scripts","author":"Jeffery Hicks","date":"November 26, 2019","format":false,"excerpt":"When it comes to PowerShell scripting we tend to focus a lot on functions and modules. We place an emphasis on building re-usable tools. The idea is that we can then use these tools at a PowerShell prompt to achieve a given task. More than likely, these tasks are repetitive.\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-21.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-21.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.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":6905,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6905","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=6905"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6905\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=6905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=6905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=6905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}