{"id":4301,"date":"2015-03-20T10:02:14","date_gmt":"2015-03-20T14:02:14","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=4301"},"modified":"2015-03-20T10:11:50","modified_gmt":"2015-03-20T14:11:50","slug":"friday-fun-get-recent-files","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/","title":{"rendered":"Friday Fun: Get Recent Files"},"content":{"rendered":"<p>As you might imagine, I work on a lot of different files throughout the week. Sometimes it is hard to keep everything straight. I'll want to return to script I was working on yesterday, but I can't remember what I called it. So I spend a few minutes searching and filtering until I find it. That takes too long. So why not create a simple PowerShell tool and load it into my profile?<\/p>\n<p>First, I need a date to filter with. I want to find all files that were last modified yesterday.<\/p>\n<pre><code>$y = (Get-Date).AddDays(-1).Date<\/code><\/pre>\n<p>If I just used the AddDays method, I would get exactly 24 hours from now, including the time. But I want since midnight. That's what the Date property gets me. The value of $y is something like Thursday, March 19, 2015 12:00:00 AM. Now it is a simple matter of getting a directory listing and filtering with this date.<\/p>\n<pre><code>dir -file | where {$_.lastwritetime -ge $y} | Sort LastWriteTime<\/code><\/pre>\n<p>I need to make sure I sort the results but do so at the end so that PowerShell is sorting the filtered results.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.png\" alt=\"\" \/><\/p>\n<p>Naturally I don't want to have to type that all the time. So here is a function to do the work for me.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 3.0\r\n\r\nFunction Get-RecentFile {\r\n\r\n[cmdletbinding()]\r\nParam(\r\n[Parameter(Position=0)]\r\n#make sure path exists and it belongs to the FileSystem provider\r\n[ValidateScript({\r\nif ((Test-Path -path $_) -AND ((Resolve-Path -path $_).Provider.Name -eq \"FileSystem\")) {\r\n    $True\r\n}\r\nelse {\r\n    Throw \"Verify path exists and is a FileSystem path.\"\r\n}\r\n})]\r\n[string]$Path = \".\",\r\n[ValidateScript({$_ -ge 0})]\r\n[int]$Days = 1,\r\n[ValidateNotNullorEmpty()]\r\n[DateTime]$Since = (Get-Date).AddDays(-$Days).Date,\r\n[int]$Newest,\r\n[ValidateNotNullorEmpty()]\r\n[string]$Filter = \"*\"\r\n)\r\n\r\nWrite-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"\r\n\r\n#get a full path path for verbose messages\r\n$Path = Resolve-Path -Path $Path\r\n\r\nWrite-Verbose -Message \"Getting files [$filter] from $path since $($Since.ToShortDateString())\"\r\n\r\n#sort last\r\n$files = Dir -path $Path -filter $Filter -File | \r\nwhere {$_.LastWriteTime -ge $Since} | \r\nSort LastWriteTime \r\n\r\nif ($Newest) {\r\n    Write-Verbose -message \"Getting $newest newest files\"\r\n    $files | Select-Object -last $Newest\r\n} \r\nelse {\r\n    $files\r\n}\r\n Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n \r\n} #end function\r\n\r\n#define an optional alias\r\nSet-Alias -Name grf -Value Get-RecentFile<\/pre>\n<p>I set the default to find all files in the current folder last modified since yesterday. I also added an option to limit the results to the newest X number of files. My scripts folder has 10 years-worth of files so this is very helpful.<\/p>\n<pre><code>grf -Days 30 -filter *.txt -Newest 3<\/code><\/pre>\n<p>I even created an alias.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe2.png\" alt=\"\" \/><\/p>\n<p>By the way, if you set the Days parameter to 0 you'll get files modified today. It also makes it easy to see what I've been working on.<\/p>\n<pre><code>get-recentfile -days 30 | group extension<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe3.png\" alt=\"\" \/><\/p>\n<p>I want to point out one other feature that you might find useful in your scripts. You'll notice that I use parameter validation a lot. If a validation test fails, PowerShell throws an exception. But sometimes you may want something a bit more elegant. In this function, I wanted to validate that the path existed and that it was a FileSystem path. A path like HKLM: would test as True but be invalid for the function's purpose.<\/p>\n<p>Here's the validation attribute:<\/p>\n<pre class=\"lang:ps decode:true \" >[ValidateScript({\r\nif ((Test-Path -path $_) -AND ((Resolve-Path -path $_).Provider.Name -eq \"FileSystem\")) {\r\n$True\r\n}\r\nelse {\r\nThrow \"Verify path exists and is a FileSystem path.\"\r\n}\r\n})]\r\n<\/pre>\n<p>When you use ValidateScript, the scriptblock must return $True or $False. If it is $False then you get the typical exception. In this case, if the path passes my tests I can tell PowerShell it is OK ($True) and the function proceeds. But if the path fails my test I'm going to write my own error message.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe4.png\" alt=\"\" \/><\/p>\n<p>As is often the case in PowerShell you have to consider who will be using your tools or script and how will they respond to errors.<\/p>\n<p>The only thing I haven't done is include any comment based help, so I'll leave that to you. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you might imagine, I work on a lot of different files throughout the week. Sometimes it is hard to keep everything straight. I&#8217;ll want to return to script I was working on yesterday, but I can&#8217;t remember what I called it. So I spend a few minutes searching and filtering until I find it&#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 from the blog-> Friday Fun: Get Recent Files with #PowerShell","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":[271,4,8],"tags":[97,568,534,540],"class_list":["post-4301","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell","category-scripting","tag-filesystem","tag-friday-fun","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>Friday Fun: Get Recent Files &#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\/powershell\/4301\/friday-fun-get-recent-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: Get Recent Files &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"As you might imagine, I work on a lot of different files throughout the week. Sometimes it is hard to keep everything straight. I&#039;ll want to return to script I was working on yesterday, but I can&#039;t remember what I called it. So I spend a few minutes searching and filtering until I find it....\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-20T14:02:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-03-20T14:11:50+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.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\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: Get Recent Files\",\"datePublished\":\"2015-03-20T14:02:14+00:00\",\"dateModified\":\"2015-03-20T14:11:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/\"},\"wordCount\":469,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/032015_1402_FridayFunGe1.png\",\"keywords\":[\"FileSystem\",\"Friday Fun\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"Friday Fun\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/\",\"name\":\"Friday Fun: Get Recent Files &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/032015_1402_FridayFunGe1.png\",\"datePublished\":\"2015-03-20T14:02:14+00:00\",\"dateModified\":\"2015-03-20T14:11:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/032015_1402_FridayFunGe1.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/032015_1402_FridayFunGe1.png\",\"width\":659,\"height\":191},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4301\\\/friday-fun-get-recent-files\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: Get Recent Files\"}]},{\"@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":"Friday Fun: Get Recent Files &#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\/powershell\/4301\/friday-fun-get-recent-files\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: Get Recent Files &#8226; The Lonely Administrator","og_description":"As you might imagine, I work on a lot of different files throughout the week. Sometimes it is hard to keep everything straight. I'll want to return to script I was working on yesterday, but I can't remember what I called it. So I spend a few minutes searching and filtering until I find it....","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/","og_site_name":"The Lonely Administrator","article_published_time":"2015-03-20T14:02:14+00:00","article_modified_time":"2015-03-20T14:11:50+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.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\/powershell\/4301\/friday-fun-get-recent-files\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: Get Recent Files","datePublished":"2015-03-20T14:02:14+00:00","dateModified":"2015-03-20T14:11:50+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/"},"wordCount":469,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.png","keywords":["FileSystem","Friday Fun","PowerShell","Scripting"],"articleSection":["Friday Fun","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/","name":"Friday Fun: Get Recent Files &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.png","datePublished":"2015-03-20T14:02:14+00:00","dateModified":"2015-03-20T14:11:50+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/03\/032015_1402_FridayFunGe1.png","width":659,"height":191},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4301\/friday-fun-get-recent-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: Get Recent Files"}]},{"@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":4220,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/4220\/friday-the-13th-fun\/","url_meta":{"origin":4301,"position":0},"title":"Friday the 13th Fun","author":"Jeffery Hicks","date":"February 13, 2015","format":false,"excerpt":"It is that time of year again. But instead of being freaked out by Friday the 13th, let's have a little fun. Here is a collection of PowerShell one-liners, all celebrating 13. And maybe you'll even pick up something new about PowerShell. #13^13 [math]::Pow(13,13) #get the 13 letter from [CHAR]\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\/2013\/12\/friday13.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/friday13.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/friday13.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/friday13.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8622,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8622\/finding-modified-files-with-powershell\/","url_meta":{"origin":4301,"position":1},"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":3579,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3579\/friday-the-13th-powershell-fun\/","url_meta":{"origin":4301,"position":2},"title":"Friday the 13th PowerShell Fun","author":"Jeffery Hicks","date":"December 13, 2013","format":false,"excerpt":"Well here are once again and another Friday the 13th. I love these days because I feel challenged to come up with 13 PowerShell related tidbits which I hope you'll find fun and maybe even a little educational. Today's collection should work primarily on PowerShell 3.0. Most items might also\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"friday13","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/friday13-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1264,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1264\/get-password-will-expire\/","url_meta":{"origin":4301,"position":3},"title":"Get Password Will Expire","author":"Jeffery Hicks","date":"March 22, 2011","format":false,"excerpt":"During my Managing Active Directory with Windows PowerShell session at Techmentor Orlando, an attendee asked about finding when a user's password would expire. He wanted to be able to come in on Monday morning and run a report to find whose passwords were going to expire during the week. I\u2026","rel":"","context":"In &quot;Active Directory&quot;","block_context":{"text":"Active Directory","link":"https:\/\/jdhitsolutions.com\/blog\/category\/active-directory\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3377,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3377\/friday-fun-get-day-of-the-year-with-powershell\/","url_meta":{"origin":4301,"position":4},"title":"Friday Fun: Get Day of the Year with PowerShell","author":"Jeffery Hicks","date":"August 30, 2013","format":false,"excerpt":"Earlier this week I was having some fun with @EnergizedTech on Twitter, playing around with dates in PowerShell. I'm not even sure where we started but the experience got me thinking and it's Friday so let's have some fun. While I can easily find out what the day of the\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"calendar","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/08\/calendar.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4169,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4169\/friday-fun-updated-ise-scripting-geek-module\/","url_meta":{"origin":4301,"position":5},"title":"Friday Fun: Updated ISE Scripting Geek Module","author":"Jeffery Hicks","date":"January 9, 2015","format":false,"excerpt":"A few years ago I published a module with a number of functions and enhancements for the PowerShell ISE. This ISEScriptingGeek module has remained popular over the last few years. But I wrote it for PowerShell v2. I have also come up with a number of new additions to the\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"geek","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/01\/geek-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4301","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=4301"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4301\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}