{"id":1900,"date":"2011-12-16T12:49:06","date_gmt":"2011-12-16T17:49:06","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1900"},"modified":"2011-12-16T12:49:06","modified_gmt":"2011-12-16T17:49:06","slug":"friday-fun-is-it-today","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/","title":{"rendered":"Friday Fun Is It Today?"},"content":{"rendered":"<p>I was testing out the PowerShell cmdlets that ship with Backup and Replication from <a href=\"http:\/\/www.veeam.com\/\" title=\"Veeam.com\" target=\"_blank\">Veeam Software<\/a>. I was using the cmdlet to return backup jobs and realized I needed a way to only get those objects where the date was today. Because the property was a complete date time object, I couldn't simply check if A -eq B. I needed something else.<!--more--><\/p>\n<p>I initially thought I could simply check the DayOftheYear property.<\/p>\n<p><code><br \/>\nPS C:\\> $d=Get-Date<br \/>\nPS C:\\> $d.DayOfYear<br \/>\n350<br \/>\nPS C:\\> $d.DayOfYear -eq $now.DayOfYear<br \/>\nTrue<br \/>\n<\/code><\/p>\n<p>But, if the two dates were exactly one year apart, I would get a false positive. Then I thought I would be clever and add the day of year to the year. Kinda like creating a hash. <\/p>\n<p><code><br \/>\nPS C:\\> $yesterday.DayOfYear+$yesterday.year -eq $now.DayOfYear+$now.year<br \/>\nFalse<br \/>\n<\/code><\/p>\n<p>However, as someone pointed out to me this logic is flawed.<\/p>\n<p><code><br \/>\nPS C:\\> [datetime]$a=\"1\/1\/2011\"<br \/>\nPS C:\\> [datetime]$b=\"1\/2\/2010\"<br \/>\nPS C:\\> $a.DayOfYear+$a.year -eq $b.DayOfYear+$b.year<br \/>\nTrue<br \/>\n<\/code><\/p>\n<p>Oops. There probably is a hash I could create but perhaps the better answer is to simply compare the two DateTime objects. For that we can use the Compare-Object cmdlet, which has an alias of diff.<\/p>\n<p><code><br \/>\nPS C:\\> diff $d $now<\/p>\n<p>InputObject                             SideIndicator<br \/>\n-----------                             -------------<br \/>\n12\/16\/2011 12:32:14 PM                  =><br \/>\n12\/16\/2011 12:26:51 PM                  <=\n<\/code><\/p>\n<p>As you can see $d and $now are both the same day. But Compare-Object is finding differences. What I can so is instruct the cmdlet to limit its comparison to specific properties.<\/p>\n<p><code><br \/>\nPS C:\\> diff $d $now -Property DayOfYear,Year<br \/>\n<\/code><\/p>\n<p>Nothing is returned so I can assume the two are identical. Let's check two that are different.<\/p>\n<p><code><br \/>\nPS C:\\> diff $a $b -Property DayOfYear,Year<\/p>\n<p>                 DayOfYear                       Year SideIndicator<br \/>\n                 ---------                       ---- -------------<br \/>\n                         2                       2010 =><br \/>\n                         1                       2011 <=\n\n\nPS C:\\> diff $yesterday $now -Property DayOfYear,Year<\/p>\n<p>                 DayOfYear                       Year SideIndicator<br \/>\n                 ---------                       ---- -------------<br \/>\n                       350                       2011 =><br \/>\n                       349                       2011 <=\n<\/code><\/p>\n<p>Differences are found so these objects are different. I can take this and turn it into a logic construct.<\/p>\n<p><code><br \/>\nPS C:\\> if (diff $yesterday $now -Property DayOfYear,Year) {$False} else {$True}<br \/>\nFalse<br \/>\nPS C:\\> if (diff $d $now -Property DayOfYear,Year) {$False} else {$True}<br \/>\nTrue<br \/>\n<\/code><\/p>\n<p>This seems to get the job done. But since that is a lot to type, and I might want to use this logic again, I'll turn it into a function.<\/p>\n<p><code><br \/>\nFunction Test-IsToday {<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter a date time value to compare\")]<br \/>\n[ValidateNotNullorEmpty()]<br \/>\n[datetime]$Date<br \/>\n)<\/p>\n<p>$now=Get-Date<br \/>\nWrite-Verbose (\"Comparing {0} to right now {1}\" -f $Date,$Now)<\/p>\n<p>if (Compare-Object -ReferenceObject $Date -DifferenceObject $Now -property dayofyear,year) {<br \/>\n  $False<br \/>\n }<br \/>\nelse {<br \/>\n $True<br \/>\n }<\/p>\n<p>} #End function<br \/>\n<\/code><\/p>\n<p>The function simply wraps up the Compare-Object command and makes it easier for me to pass dates.<\/p>\n<p><code><br \/>\nPS C:\\> test-istoday $now<br \/>\nTrue<br \/>\nPS C:\\> test-istoday $d -verbose<br \/>\nVERBOSE: Comparing 12\/16\/2011 12:26:51 PM to right now 12\/16\/2011 12:43:25 PM<br \/>\nTrue<br \/>\nPS C:\\> test-istoday $yesterday<br \/>\nFalse<br \/>\nPS C:\\> test-istoday \"12\/25\/2011\"<br \/>\nFalse<br \/>\nPS C:\\><br \/>\n<\/code><\/p>\n<p>So far I haven't found a case where this won't work correctly. But if there is, most likely all I'll need to do is add another property comparison with Compare-Object.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/Test-IsToday.txt' target='_blank'>Test-IsToday<\/a> and try it out for yourself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was testing out the PowerShell cmdlets that ship with Backup and Replication from Veeam Software. I was using the cmdlet to return backup jobs and realized I needed a way to only get those objects where the date was today. Because the property was a complete date time object, I couldn&#8217;t simply check if&#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,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[271,4],"tags":[344,343,534],"class_list":["post-1900","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell","tag-compare-object","tag-functons","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun Is It Today? &#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\/1900\/friday-fun-is-it-today\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun Is It Today? &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I was testing out the PowerShell cmdlets that ship with Backup and Replication from Veeam Software. I was using the cmdlet to return backup jobs and realized I needed a way to only get those objects where the date was today. Because the property was a complete date time object, I couldn&#039;t simply check if...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-12-16T17:49:06+00:00\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun Is It Today?\",\"datePublished\":\"2011-12-16T17:49:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/\"},\"wordCount\":320,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"Compare-Object\",\"functons\",\"PowerShell\"],\"articleSection\":[\"Friday Fun\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/\",\"name\":\"Friday Fun Is It Today? &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-12-16T17:49:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1900\\\/friday-fun-is-it-today\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun Is It Today?\"}]},{\"@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 Is It Today? &#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\/1900\/friday-fun-is-it-today\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun Is It Today? &#8226; The Lonely Administrator","og_description":"I was testing out the PowerShell cmdlets that ship with Backup and Replication from Veeam Software. I was using the cmdlet to return backup jobs and realized I needed a way to only get those objects where the date was today. Because the property was a complete date time object, I couldn't simply check if...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-12-16T17:49:06+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun Is It Today?","datePublished":"2011-12-16T17:49:06+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/"},"wordCount":320,"commentCount":6,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["Compare-Object","functons","PowerShell"],"articleSection":["Friday Fun","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/","name":"Friday Fun Is It Today? &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-12-16T17:49:06+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1900\/friday-fun-is-it-today\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun Is It Today?"}]},{"@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_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1962,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1962\/friday-fun-whats-my-variable\/","url_meta":{"origin":1900,"position":0},"title":"Friday Fun What&#8217;s My Variable","author":"Jeffery Hicks","date":"January 6, 2012","format":false,"excerpt":"I use scriptblocks quite a bit in my PowerShell work, often saved as variables. These are handy for commands you want to run again, but don't necessarily need to turn into permanent functions. $freec={(get-wmiobject win32_logicaldisk -filter \"deviceid='c:'\" -property Freespace).FreeSpace\/1mb} Now in PowerShell I can invoke the scriptblock. PS S:\\> &$freec\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\/01\/get-variabletype-1-300x197.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2720,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2720\/silly-saturday-powershell-palindromes\/","url_meta":{"origin":1900,"position":1},"title":"Silly Saturday PowerShell Palindromes","author":"Jeffery Hicks","date":"January 19, 2013","format":false,"excerpt":"Normally I post amusing PowerShell-related content on Fridays as part of my Friday Fun series. These are light-hearted articles about using PowerShell. Almost always they are not practical but they serve as a learning vehicle. My topic this week seems extra silly so I'm moving it to Saturday. I'm a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"242px-Sator_Square_at_Opp\u00e8de","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/242px-Sator_Square_at_Opp%C3%A8de-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":700,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/700\/running-veeam-jobs\/","url_meta":{"origin":1900,"position":2},"title":"Running Veeam Jobs","author":"Jeffery Hicks","date":"July 12, 2010","format":false,"excerpt":"I\u2019m still fighting hardware issues with my ESX box (among other things) but I wanted to jot down some more notes on my experiences with PowerCLI and the Veeam backup cmdlets. Last week I wrote about how I created multiple backup jobs with a one line PowerShell expression.\u00a0 After the\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1554,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1554\/friday-fun-powershell-powerball-numbers\/","url_meta":{"origin":1900,"position":3},"title":"Friday Fun PowerShell PowerBall Numbers","author":"Jeffery Hicks","date":"July 8, 2011","format":false,"excerpt":"Like many of you, I dream about hitting the lottery and retiring to live the good life. Unfortunately I rarely play so I guess my odds are winning are pretty slim. But for the latest installment of Friday Fun, I thought I would have PowerShell help me pick some numbers\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":"","width":0,"height":0},"classes":[]},{"id":1580,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1580\/filtering-empty-values-in-powershell\/","url_meta":{"origin":1900,"position":4},"title":"Filtering Empty Values in PowerShell","author":"Jeffery Hicks","date":"August 3, 2011","format":false,"excerpt":"I saw this tip today and wanted to leave a comment but couldn't see how. So I thought I'd post my comments here. This is actually a question I see often and there are better ways to write this kind of code. The posted tip used an example where you\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":"","width":0,"height":0},"classes":[]},{"id":7549,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7549\/building-a-powershell-inventory\/","url_meta":{"origin":1900,"position":5},"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":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1900","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=1900"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1900\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}