{"id":8593,"date":"2021-09-28T10:15:56","date_gmt":"2021-09-28T14:15:56","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8593"},"modified":"2021-09-28T10:16:00","modified_gmt":"2021-09-28T14:16:00","slug":"theres-a-file-in-my-powershell-bucket","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/","title":{"rendered":"There&#8217;s a File in My PowerShell Bucket"},"content":{"rendered":"\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"615\" height=\"345\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg\" alt=\"\" class=\"wp-image-8594\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg 615w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small-300x168.jpg 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>If there's one task I've never stopped doing, it is finding files. I am constantly creating new ways to organize files and display them in a meaningful format. Naturally, PowerShell is a great tool for this task. Get-ChildItem is obviously the proper starting point. The cmdlet works fine in getting only files from a folder and I can do basic early filtering by name and extension with wildcards.  But my latest task was organizing files by date, and because of the way Get-ChildItem works under-the-hood, I'm going to need to resort to late filtering with Where-Object. There's nothing wrong with that. But if this is a task I'm likely to repeat, then a PowerShell function is on the drawing board. My goal is to create a function that will display files grouped into aging buckets such as 1-week or 6-months. Even though I'm primarily concerned with age based on the last write time, I (or you) might have a need to base aging on the creation time. Let's code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Building a List<\/h2>\n\n\n\n<p>My function will take pipeline input from Get-Childitem. However, because I'm going to be sorting and grouping files, I can't do that until all of the files from Get-ChildItem have been processed by my function. I need to temporarily store them as they come through the pipeline. I could use an array object and add each pipelined object to it. My code might look something like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Begin {\n    $files = @()\n}\nProcess {\n    $files += $inputobject\n}\nEnd {\n    $files | Sort-Object -property LastWriteTime ...\n}<\/code><\/pre>\n\n\n\n<p>There's technically nothing wrong with this approach and I have used it for years. But lately, I've been turning to a generic list. Specifically a [System.Collections.Generic.list[]] object. The reason is that when you add to an array, each time you add an element the array is wiped out and rebuilt. For a small number of items, that is no problem. But I could be processing thousands of files. There will be a slight performance trade-off for ease of use.  I added almost 9000 files to an array in just over 3 seconds. Using the generic list took less than a second.<\/p>\n\n\n\n<p>In the Begin block of my function, I could define the collection object like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$list = [system.Collections.Generic.list[system.io.fileinfo]]::new()<\/code><\/pre>\n\n\n\n<p>But, I'm going to use a scripting technique to simplify that syntax. In the .ps1 file that defines my function, before the function I'm going to insert a Using statement.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Using namespace System.Collections.Generic<\/code><\/pre>\n\n\n\n<p>Now in the Begin block, my definition is much simpler:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"> $list = [List[System.IO.FileInfo]]::new()<\/code><\/pre>\n\n\n\n<p>You generally tell PowerShell what type of object is going into your list. In my case, I know it will be System.IO.FileInfo objects. If you are unsure or will have a mix of objects, you can simply use 'object'.<\/p>\n\n\n\n<p>The list object has a number of methods that I won't get into here.  In the Process block, I'll add each file to the list.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"> $list.Add($FilePath)<\/code><\/pre>\n\n\n\n<p>When I get to the End block, $list will contain all the files piped into my function. Now I can do my bucket magic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Age Grouping<\/h2>\n\n\n\n<p>I had to decide what kind of aging buckets I wanted. I decided by year, month, and number of days.  I'll control this with a parameter.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[Parameter(HelpMessage = \"How do you want the files organized? The default is Month.\")]\n[ValidateNotNullOrEmpty()]\n[ValidateSet(\"Month\",\"Year\",\"Days\")]\n[string]$GroupBy = \"Month\"<\/code><\/pre>\n\n\n\n<p>I also needed to control what I was basing aging decisions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[Parameter(HelpMessage = \"Specify if grouping by the file's CreationTime or LastWriteTime property. The default is LastWriteTime.\")]\n[ValidateSet(\"CreationTime\",\"LastWritetime\")]\n[ValidateNotNullOrEmpty()]\n[string]$Property = \"LastWriteTime\",<\/code><\/pre>\n\n\n\n<p>For each file in my list, I need to add a property that indicates its age group. I know I'm going to add a property to the file object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$file | Add-Member -MemberType NoteProperty -Name AgeGroup -Value $value<\/code><\/pre>\n\n\n\n<p>The value will be calculated based on the grouping bucket. If I want to group on the Year, for each file I will run this code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$value = $file.$property.year\n$sort = \"AgeGroup\"<\/code><\/pre>\n\n\n\n<p>The $sort variable will be used at the end of the function to help format the output. For month grouping, I needed the month and the year. I also needed to turn the value into a DateTime object so that it would sort properly. $Property will be either CreationTime or LastWriteTime.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$value = \"$($file.$property.month)\/$($file.$property.year)\"\n$sort = {$_.AgeGroup -as [datetime]}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Custom Property Custom Values<\/h2>\n\n\n\n<p>Grouping on the number of days was the trickiest step. I decided to define a set of bucket names like OneWeek and SixMonth. However, this meant sorting would be on the string value which wouldn't be accurate. My solution was to define an Enum in my function file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Enum FileAge {\n    YearPlus\n    Year\n    NineMonth\n    SixMonth\n    ThreeMonth\n    OneMonth\n    OneWeek\n    OneDay\n}<\/code><\/pre>\n\n\n\n<p>Why? Because in an Enum, each value actually has a numeric value starting at 0. Even though I'm using strings to indicate the aging bucket, when I sort, it will be on the implicit numeric value. With this enum, I can assign a value based on the total days.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$age = New-TimeSpan -start $file.$property -end $now\n$value = switch ($age.totaldays -as [int]) {\n    {$_ -ge 365} {[FileAge]::YearPlus ; break}\n    {$_ -gt 270 -AND $_ -lt 365 }{[FileAge]::Year;break}\n    {$_ -gt 180 -AND $_ -le 270 }{[FileAge]::NineMonth;break}\n    {$_ -gt 90 -AND $_ -le 180} {[FileAge]::SixMonth;break}\n    {$_ -gt 30 -AND $_ -le 90} {[FileAge]::ThreeMonth;break}\n    {$_ -gt 7 -AND $_ -le 30} {[FileAge]::OneMonth;break}\n    {$_ -gt 1 -And $_ -le 7} {[FileAge]::OneWeek;break}\n    {$_ -le 1} {[FileAge]::OneDay;break}\n}\n$sort = \"AgeGroup\"<\/code><\/pre>\n\n\n\n<p>I could have created a custom object, even using a PowerShell class. But I'm happy to piggyback on the System.IO.FileInfo type. However, the default formatting doesn't know anything about my custom property. I know I'll want to create my own formatting so I need to insert a new type name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"> $file.psobject.TypeNames.insert(0,\"FileAgingInfo\")<\/code><\/pre>\n\n\n\n<p>Planning ahead, I know I will be using grouping in my custom formatting, which means the objects need to be sorted. Normally, I'd leave sorting out of a function, but in this case, I need it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$list | Sort-Object -Property $sort,DirectoryName,$property,Name<\/code><\/pre>\n\n\n\n<p>I am sorting first on my $sort variable, then the directory name, then the CreationTime or LastWriteTime property, and finally the file name. <\/p>\n\n\n\n<p>Here's the complete function:<\/p>\n\n\n\n<pre title=\"Get-FileAgeGroup.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#requires -version 5.1\n\n#declaring a namespace here makes the code simpler later on\nUsing namespace System.Collections.Generic\n\n#define an enumeration that will be used in a new custom property\nEnum FileAge {\n    YearPlus\n    Year\n    NineMonth\n    SixMonth\n    ThreeMonth\n    OneMonth\n    OneWeek\n    OneDay\n}\nFunction Get-FileAgeGroup {\n    [cmdletbinding()]\n    [alias(\"gfa\")]\n    [OutputType(\"FileAgingInfo\")]\n    Param(\n        [Parameter(Mandatory,Position=0,ValueFromPipeline,HelpMessage = \"The path to a file. If you pipe from a Get-ChildItem command, be sure to use the -File parameter.\")]\n        [ValidateNotNullOrEmpty()]\n        [System.IO.FileInfo]$FilePath,\n        [Parameter(HelpMessage = \"Specify if grouping by the file's CreationTime or LastWriteTime property. The default is LastWriteTime.\")]\n        [ValidateSet(\"CreationTime\",\"LastWritetime\")]\n        [ValidateNotNullOrEmpty()]\n        [string]$Property = \"LastWriteTime\",\n        [Parameter(HelpMessage = \"How do you want the files organized? The default is Month.\")]\n        [ValidateNotNullOrEmpty()]\n        [ValidateSet(\"Month\",\"Year\",\"Days\")]\n        [string]$GroupBy = \"Month\"\n    )\n    Begin {\n        Write-Verbose \"[$((Get-Date).TimeofDay) BEGIN  ] Starting $($myinvocation.mycommand)\"\n        Write-Verbose \"[$((Get-Date).TimeofDay) BEGIN  ] Grouping by $GroupBy on the $Property property\"\n\n        #initialize a list to contain all piped in files\n        #this code is shorter because of the Using statement at the beginning of this file\n        $list = [List[System.IO.FileInfo]]::new()\n\n        #get a static value for now\n        $now = Get-Date\n    } #begin\n\n    Process {\n        Write-Verbose \"[$((Get-Date).TimeofDay) PROCESS] Adding $FilePath\"\n        #add each file to the list\n        $list.Add($FilePath)\n    } #process\n\n    End {\n        #now process all the files and add aging properties\n        Write-Verbose \"[$((Get-Date).TimeofDay) END    ] Sorting $($list.count) files\"\n\n        #add custom properties based on the age grouping\n        foreach ($file in $list) {\n            switch ($GroupBy) {\n                \"Month\" {\n                    $value = \"$($file.$property.month)\/$($file.$property.year)\"\n                    $sort = {$_.AgeGroup -as [datetime]}\n                }\n                \"Year\" {\n                    $value = $file.$property.year\n                    $sort = \"AgeGroup\"\n                }\n                \"Days\" {\n                    $age = New-TimeSpan -start $file.$property -end $now\n                    $value = switch ($age.totaldays -as [int]) {\n                        {$_ -ge 365} {[FileAge]::YearPlus ; break}\n                        {$_ -gt 270 -AND $_ -lt 365 }{[FileAge]::Year;break}\n                        {$_ -gt 180 -AND $_ -le 270 }{[FileAge]::NineMonth;break}\n                        {$_ -gt 90 -AND $_ -le 180} {[FileAge]::SixMonth;break}\n                        {$_ -gt 30 -AND $_ -le 90} {[FileAge]::ThreeMonth;break}\n                        {$_ -gt 7 -AND $_ -le 30} {[FileAge]::OneMonth;break}\n                        {$_ -gt 1 -And $_ -le 7} {[FileAge]::OneWeek;break}\n                        {$_ -le 1} {[FileAge]::OneDay;break}\n                    }\n                    $sort = \"AgeGroup\"\n                }\n            } #switch\n\n            #add a custom property to each file object\n            $file | Add-Member -MemberType NoteProperty -Name AgeGroup -Value $value\n\n            #insert a custom type name which will be used by the custom format file\n            $file.psobject.TypeNames.insert(0,\"FileAgingInfo\")\n        } #foreach file\n\n        #write the results to the pipeline. Sorting results so that the default\n        #formatting will be displayed properly\n        $list | Sort-Object -Property $sort,DirectoryName,$property,Name\n\n        Write-Verbose \"[$((Get-Date).TimeofDay) END    ] Ending $($myinvocation.mycommand)\"\n    } #end\n\n} #close Get-FileAgeGroup<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Formatted Output<\/h2>\n\n\n\n<p>The whole point of this work is to make it easy for me to see files grouped by age like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage.png\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"606\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage.png\" alt=\"\" class=\"wp-image-8597\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage.png 783w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage-300x232.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage-768x594.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/a><\/figure>\n\n\n\n<p>This is why I needed a custom typename and pre-sorted output. I used <a href=\"http:\/\/bit.ly\/31SGo5o\" target=\"_blank\" rel=\"noreferrer noopener\">New-PSFormatXML<\/a> to create a custom format ps1xml file. <\/p>\n\n\n\n<pre title=\"fileage.format.ps1xml\" class=\"wp-block-code\"><code lang=\"xml\" class=\"language-xml\">&lt;!--\nFormat type data generated 09\/17\/2021 11:54:13 by PROSPERO\\Jeff\n\nThis file was created using the New-PSFormatXML command that is part\nof the PSScriptTools module.\n\nhttps:\/\/github.com\/jdhitsolutions\/PSScriptTools\n-->\n&lt;Configuration>\n  &lt;ViewDefinitions>\n    &lt;View>\n      &lt;!--Created 09\/17\/2021 11:54:13 by PROSPERO\\Jeff-->\n      &lt;Name>default&lt;\/Name>\n      &lt;ViewSelectedBy>\n        &lt;TypeName>FileAgingInfo&lt;\/TypeName>\n      &lt;\/ViewSelectedBy>\n      &lt;GroupBy>\n        &lt;!--\n            You can also use a scriptblock to define a custom property name.\n            You must have a Label tag.\n            &lt;ScriptBlock>$_.machinename.toUpper()&lt;\/ScriptBlock>\n            &lt;Label>Computername&lt;\/Label>\n\n            Use &lt;Label> to set the displayed value.\n-->\n        &lt;PropertyName>AgeGroup&lt;\/PropertyName>\n        &lt;Label>AgeGroup&lt;\/Label>\n      &lt;\/GroupBy>\n      &lt;TableControl>\n        &lt;!--Delete the AutoSize node if you want to use the defined widths.-->\n        &lt;AutoSize \/>\n        &lt;TableHeaders>\n          &lt;TableColumnHeader>\n            &lt;Label>Directory&lt;\/Label>\n            &lt;Width>16&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>Created&lt;\/Label>\n            &lt;Width>24&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>Modified&lt;\/Label>\n            &lt;Width>23&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>Length&lt;\/Label>\n            &lt;Width>11&lt;\/Width>\n            &lt;Alignment>right&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>Name&lt;\/Label>\n            &lt;Width>10&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n        &lt;\/TableHeaders>\n        &lt;TableRowEntries>\n          &lt;TableRowEntry>\n            &lt;TableColumnItems>\n              &lt;!--\n            By default the entries use property names, but you can replace them with scriptblocks.\n            &lt;ScriptBlock>$_.foo \/1mb -as [int]&lt;\/ScriptBlock>\n-->\n              &lt;TableColumnItem>\n                &lt;PropertyName>DirectoryName&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>CreationTime&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>LastWriteTime&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>Length&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>Name&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n            &lt;\/TableColumnItems>\n          &lt;\/TableRowEntry>\n        &lt;\/TableRowEntries>\n      &lt;\/TableControl>\n    &lt;\/View>\n  &lt;\/ViewDefinitions>\n&lt;\/Configuration><\/code><\/pre>\n\n\n\n<p>At the end of my ps1 file, I import the format file into my PowerShell session.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Update-FormatData $psscriptroot\\FileAge.format.ps1xml<\/code><\/pre>\n\n\n\n<p>I only have a single view for now.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"444\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage2.png\" alt=\"\" class=\"wp-image-8598\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage2.png 642w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage2-300x207.png 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/a><\/figure>\n\n\n\n<p>Because I'm using the enum, my files are properly sorted and I get meaningful output. I might need to tweak the format file a bit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"599\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png\" alt=\"\" class=\"wp-image-8599\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png 941w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3-300x191.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3-768x489.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3-850x541.png 850w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/a><\/figure>\n\n\n\n<p>Or I can adjust my PowerShell expression.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"398\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4-1024x398.png\" alt=\"\" class=\"wp-image-8600\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4-1024x398.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4-300x117.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4-768x298.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4-850x330.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage4.png 1081w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>As with many of my posts, the end result isn't as important as the techniques I used to get there.  Comments and questions are welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If there&#8217;s one task I&#8217;ve never stopped doing, it is finding files. I am constantly creating new ways to organize files and display them in a meaningful format. Naturally, PowerShell is a great tool for this task. Get-ChildItem is obviously the proper starting point. The cmdlet works fine in getting only files from a folder&#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: There's a File in My #PowerShell Bucket","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,8],"tags":[123,240,224,534,540],"class_list":["post-8593","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-files","tag-formatting","tag-function","tag-powershell","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>There&#039;s a File in My PowerShell Bucket &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"Here&#039;s my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.\" \/>\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\/8593\/theres-a-file-in-my-powershell-bucket\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"There&#039;s a File in My PowerShell Bucket &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-28T14:15:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-28T14:16:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg\" \/>\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=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"There&#8217;s a File in My PowerShell Bucket\",\"datePublished\":\"2021-09-28T14:15:56+00:00\",\"dateModified\":\"2021-09-28T14:16:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/\"},\"wordCount\":1006,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/metal-buckets-small.jpg\",\"keywords\":[\"Files\",\"formatting\",\"Function\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/\",\"name\":\"There's a File in My PowerShell Bucket &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/metal-buckets-small.jpg\",\"datePublished\":\"2021-09-28T14:15:56+00:00\",\"dateModified\":\"2021-09-28T14:16:00+00:00\",\"description\":\"Here's my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/metal-buckets-small.jpg\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/metal-buckets-small.jpg\",\"width\":615,\"height\":345},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8593\\\/theres-a-file-in-my-powershell-bucket\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"There&#8217;s a File in My PowerShell Bucket\"}]},{\"@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":"There's a File in My PowerShell Bucket &#8226; The Lonely Administrator","description":"Here's my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.","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\/8593\/theres-a-file-in-my-powershell-bucket\/","og_locale":"en_US","og_type":"article","og_title":"There's a File in My PowerShell Bucket &#8226; The Lonely Administrator","og_description":"Here's my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/","og_site_name":"The Lonely Administrator","article_published_time":"2021-09-28T14:15:56+00:00","article_modified_time":"2021-09-28T14:16:00+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg","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":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"There&#8217;s a File in My PowerShell Bucket","datePublished":"2021-09-28T14:15:56+00:00","dateModified":"2021-09-28T14:16:00+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/"},"wordCount":1006,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg","keywords":["Files","formatting","Function","PowerShell","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/","name":"There's a File in My PowerShell Bucket &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg","datePublished":"2021-09-28T14:15:56+00:00","dateModified":"2021-09-28T14:16:00+00:00","description":"Here's my latest attempt in organizing files with PowerShell based on aging bucket such as last modified 7 days ago.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/metal-buckets-small.jpg","width":615,"height":345},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"There&#8217;s a File in My PowerShell Bucket"}]},{"@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":8622,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8622\/finding-modified-files-with-powershell\/","url_meta":{"origin":8593,"position":0},"title":"Finding Modified Files with PowerShell","author":"Jeffery Hicks","date":"October 14, 2021","format":false,"excerpt":"Here's another task that I seem to be constantly fiddling with using PowerShell. What files did I work on yesterday? Or what files were modified in the last 48 hours? Obviously, Get-ChildItem is going to be the primary command. It is simple enough to get files based on an extension\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\/2021\/10\/extension-report.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/extension-report.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/extension-report.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":7317,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","url_meta":{"origin":8593,"position":1},"title":"Fast Folder Sizes with PowerShell","author":"Jeffery Hicks","date":"February 25, 2020","format":false,"excerpt":"I am always looking for ways to do things faster and easier with PowerShell. One common task that I never seem to stop needing is discovering how much disk space a given folder is consuming. Even though disk space is cheap these days, I guess I'm old-school enough to want\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\/2020\/02\/getfoldersize3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":9057,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9057\/using-powershell-your-way\/","url_meta":{"origin":8593,"position":2},"title":"Using PowerShell Your Way","author":"Jeffery Hicks","date":"June 6, 2022","format":false,"excerpt":"I've often told people that I spend my day in a PowerShell prompt. I run almost my entire day with PowerShell. I've shared many of the tools I use daily on Github. Today, I want to share another way I have PowerShell work the way I need it, with minimal\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\/2022\/06\/dl.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7549,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7549\/building-a-powershell-inventory\/","url_meta":{"origin":8593,"position":3},"title":"Building a PowerShell Inventory","author":"Jeffery Hicks","date":"June 16, 2020","format":false,"excerpt":"A few weeks ago, a new Iron Scripter PowerShell scripting challenge was issued. For this challenge we were asked to write some PowerShell code that we could use to inventory our PowerShell script library.\u00a0 Here's how I approached the problem, which by no means is the only way. Lines of\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\/2020\/06\/ast-results.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/ast-results.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/ast-results.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2673,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2673\/friday-fun-edit-recent-file\/","url_meta":{"origin":8593,"position":4},"title":"Friday Fun: Edit Recent File","author":"Jeffery Hicks","date":"January 4, 2013","format":false,"excerpt":"As you might imagine I work on a lot of PowerShell projects at the same time. Sometimes I'll start something at the beginning of the week and then need to come back to it at the end of the week. The problem is that I can't always remembered what I\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"Edit-RecentFile","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/Edit-RecentFile-300x209.png?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":8593,"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\/8593","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=8593"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8593\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}