{"id":2925,"date":"2013-04-09T09:40:55","date_gmt":"2013-04-09T13:40:55","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2925"},"modified":"2013-04-09T09:44:56","modified_gmt":"2013-04-09T13:44:56","slug":"file-age-groupings-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/","title":{"rendered":"File Age Groupings with PowerShell"},"content":{"rendered":"<p>I'm always talking about how much the object-nature of PowerShell makes all the difference in the world. Today, I have another example. Let's say you want to analyze a directory, perhaps a shared group folder for a department. And you want to identify files that haven't been modified in a while. I like this topic because it is real world and offers a good framework for demonstrating PowerShell techniques.<\/p>\n<p>You would like to divide the files into aging \"buckets\". Let's begin by getting all of the files. I'm using PowerShell 3.0 so you'll have to adjust parameters if you are using 2.0. You can run all of this interactively in the console, but I think you'll find using a script much easier.<\/p>\n<pre class=\"lang:ps decode:true\">$files = dir c:\\work -recurse -file<\/pre>\n<p>Now, let's add a new property, or member, to the file object called FileAgeDays which will be the value of the number of days since the file was last modified, based on the LastWriteTime property. We'll use the Add-Member cmdlet to define this property.<\/p>\n<pre class=\"lang:ps decode:true\">$files | Add-Member ScriptProperty -Name FileAgeDays -Value {\r\n [int]((Get-Date) - ($this.LastWriteTime)).TotalDays }<\/pre>\n<p>The new property is technically a ScriptProperty so that we can run a scriptblock to define the value. In this case we're subtracting the LastwriteTime value of the each object from the current date and time. This will return a TimeStamp object but all we need is the TotalDays property which is cast as an integer, effectively rounding the value. In a pipelined expression like Select-Object you would use $_ to indicate the current object in the pipeline. Here, we can use $this.<\/p>\n<p>Next, we'll add another script property to define our \"bucket\" property.<\/p>\n<pre class=\"lang:ps decode:true\">$files | Add-Member ScriptProperty -Name FileAge -Value {\r\n    if ($this.FileAgeDays -ge 365) {\r\n        \"1year\"\r\n    }\r\n    elseif ($this.FileAgeDays -ge 180) {\r\n        \"6Months\"\r\n    }\r\n    elseif ($this.FileAgeDays -ge 90) {\r\n        \"90Days\"\r\n    }\r\n    elseif ($this.FileAgeDays -ge 45) {\r\n        \"45Days\"\r\n    }\r\n    else {\r\n        \"Current\"\r\n    }\r\n}<\/pre>\n<p>The script block can be as long as you need it to be. Here, we're using an If\/ElseIf construct based on the FileAgeDays property we just created. If we look at $files now, we won't see these new properties.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2926\" alt=\"fileage-01\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.png\" width=\"625\" height=\"255\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-300x123.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-624x255.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01.png 1163w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>But that is because the new properties aren't part of the default display settings. So we need to specify them.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2927\" alt=\"fileage-02\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02-1024x418.png\" width=\"625\" height=\"255\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02-1024x418.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02-300x122.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02-624x254.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-02.png 1166w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>Now, we can group the objects based on these new properties.<\/p>\n<pre class=\"lang:default decode:true\">$files | Group FileAge -NoElement | sort Count -Descending<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2928\" alt=\"fileage-03\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03-1024x420.png\" width=\"625\" height=\"256\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03-1024x420.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03-300x123.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03-624x256.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-03.png 1170w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a>Or perhaps we'd like to drill down a bit more.<\/p>\n<pre class=\"lang:ps decode:true \">$grouped = $files | Group FileAge | \r\nAdd-Member -MemberType ScriptProperty -Name SizeMB -Value {\r\n  ($this.Group | Measure-Object Length -sum).Sum \/ 1MB\r\n} -PassThru<\/pre>\n<p>Now we've added a new member to the GroupInfo object that will show the total size of all files in each group by MB. Don't forget to use -Passthru to force PowerShell to write the new object back to the pipeline so it can be saved in the grouped variable. Finally, the result:<\/p>\n<pre class=\"lang:default decode:true\">$grouped | Sort SizeMB -Descending | Format-Table SizeMB,Count,Name -AutoSize<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2929\" alt=\"fileage-04\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04-1024x421.png\" width=\"625\" height=\"256\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04-1024x421.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04-300x123.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04-624x256.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-04.png 1164w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>And there you go. Because we're working with objects, adding new information is really quite easy. Certainly much easier than trying to do something like this in VBScript! And even if you don't need this specific solution, I hope that you picked up a technique or two.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m always talking about how much the object-nature of PowerShell makes all the difference in the world. Today, I have another example. Let&#8217;s say you want to analyze a directory, perhaps a shared group folder for a department. And you want to identify files that haven&#8217;t been modified in a while. I like this topic&#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":"","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":[135],"tags":[139,137,342,534],"class_list":["post-2925","post","type-post","status-publish","format-standard","hentry","category-windows-server","tag-add-member","tag-get-childitem","tag-group-object","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>File Age Groupings with PowerShell &#8226; The Lonely Administrator<\/title>\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\/windows-server\/2925\/file-age-groupings-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"File Age Groupings with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;m always talking about how much the object-nature of PowerShell makes all the difference in the world. Today, I have another example. Let&#039;s say you want to analyze a directory, perhaps a shared group folder for a department. And you want to identify files that haven&#039;t been modified in a while. I like this topic...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-09T13:40:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-04-09T13:44:56+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"File Age Groupings with PowerShell\",\"datePublished\":\"2013-04-09T13:40:55+00:00\",\"dateModified\":\"2013-04-09T13:44:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/\"},\"wordCount\":462,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/fileage-01-1024x419.png\",\"keywords\":[\"Add-Member\",\"Get-ChildItem\",\"Group-Object\",\"PowerShell\"],\"articleSection\":[\"Windows Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/\",\"name\":\"File Age Groupings with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/fileage-01-1024x419.png\",\"datePublished\":\"2013-04-09T13:40:55+00:00\",\"dateModified\":\"2013-04-09T13:44:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/fileage-01.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/fileage-01.png\",\"width\":1163,\"height\":477},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/windows-server\\\/2925\\\/file-age-groupings-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Windows Server\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/windows-server\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"File Age Groupings with PowerShell\"}]},{\"@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":"File Age Groupings with PowerShell &#8226; The Lonely Administrator","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\/windows-server\/2925\/file-age-groupings-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"File Age Groupings with PowerShell &#8226; The Lonely Administrator","og_description":"I'm always talking about how much the object-nature of PowerShell makes all the difference in the world. Today, I have another example. Let's say you want to analyze a directory, perhaps a shared group folder for a department. And you want to identify files that haven't been modified in a while. I like this topic...","og_url":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-04-09T13:40:55+00:00","article_modified_time":"2013-04-09T13:44:56+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"File Age Groupings with PowerShell","datePublished":"2013-04-09T13:40:55+00:00","dateModified":"2013-04-09T13:44:56+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/"},"wordCount":462,"commentCount":9,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.png","keywords":["Add-Member","Get-ChildItem","Group-Object","PowerShell"],"articleSection":["Windows Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/","name":"File Age Groupings with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01-1024x419.png","datePublished":"2013-04-09T13:40:55+00:00","dateModified":"2013-04-09T13:44:56+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/fileage-01.png","width":1163,"height":477},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/windows-server\/2925\/file-age-groupings-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Windows Server","item":"https:\/\/jdhitsolutions.com\/blog\/category\/windows-server\/"},{"@type":"ListItem","position":2,"name":"File Age Groupings with PowerShell"}]},{"@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":2925,"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":6996,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6996\/powershell-controller-scripts\/","url_meta":{"origin":2925,"position":1},"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":3025,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3025\/scrub-up-powershell-content\/","url_meta":{"origin":2925,"position":2},"title":"Scrub Up PowerShell Content","author":"Jeffery Hicks","date":"May 14, 2013","format":false,"excerpt":"It is probably a safe bet to say that IT Pros store a lot of information in simple text files. There's nothing with this. Notepad is ubiquitous and text files obviously easy to use. I bet you have text files of computer names, user names, service names, directories and probably\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"scrubbrush","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/05\/scrubbrush-300x214.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1136,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1136\/friday-fun-snappy-shortcuts\/","url_meta":{"origin":2925,"position":3},"title":"Friday Fun &#8211; Snappy Shortcuts","author":"Jeffery Hicks","date":"February 11, 2011","format":false,"excerpt":"In one of my recent Prof. PowerShell columns, I wrote about using the Wscript.Shell VBScript object in PowerShell to retrieve special folder paths. Another handy trick is the ability to create shortcut links to either file or web resources. Let me show you how to accomplish this in PowerShell and\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/create-shortcuts-300x185.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4112,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4112\/scary-powershell\/","url_meta":{"origin":2925,"position":4},"title":"Scary PowerShell","author":"Jeffery Hicks","date":"October 31, 2014","format":false,"excerpt":"In honor of today's festivities, at least in the United States, I thought we'd look at some scary PowerShell. I have seen a lot of scary things in blog posts, tweets and forum discussions. Often these scary things are from people just getting started with PowerShell who simply haven't learned\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/10\/103114_1654_ScaryPowerS1.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2330,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2330\/friday-fun-get-latest-powershell-scripts\/","url_meta":{"origin":2925,"position":5},"title":"Friday Fun: Get Latest PowerShell Scripts","author":"Jeffery Hicks","date":"May 18, 2012","format":false,"excerpt":"Probably like many of you I keep almost all of my scripts in a single location. I'm also usually working on multiple items at the same time. Some times I have difficult remembering the name of a script I might have been working on a few days ago that I\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/get-latestscript-300x133.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2925","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=2925"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2925\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}