{"id":1912,"date":"2011-12-23T12:25:22","date_gmt":"2011-12-23T17:25:22","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1912"},"modified":"2011-12-23T12:25:22","modified_gmt":"2011-12-23T17:25:22","slug":"friday-fun-get-ranked-object","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/","title":{"rendered":"Friday Fun &#8211; Get Ranked Object"},"content":{"rendered":"<p>Earlier this week on Google Plus, <a href=\"https:\/\/plus.google.com\/106423422372421380780\/posts\" title=\"Check out Hal's Google Plus page\" target=\"_blank\">Hal Rottenberg<\/a> posted a PowerShell idea he had. His goal was to identify a group of objects that would be statistically significant. For example, given a collection of files, group the files by size but ranked by size so that you might have a group for the largest files, then big files, then average files and finally small files. His idea was to calculate a rank using a logarithm of the file size. His code was quick and dirty so I took it, as I usually do, and ran with it. The result is a function that will analyse any group of objects and rank them based on a numeric property.<!--more--><\/p>\n<p>The essence of the function is to take the property value and calculate its log using the largest property value as the base. If we use a file as an example, suppose the largest file size is 12500. Calculating the log of other file size with this as the base provides results like this:<\/p>\n<p><code><br \/>\nPS S:\\> [math]::log(12345,12500)<br \/>\n0.998677315654261<br \/>\nPS S:\\> [math]::log(1244,12500)<br \/>\n0.755403553050584<br \/>\nPS S:\\> [math]::log(123,12500)<br \/>\n0.510117406729404<br \/>\nPS S:\\> [math]::log(90,12500)<br \/>\n0.47700401112898<br \/>\nPS S:\\><br \/>\n<\/code><\/p>\n<p>The larger the file, the higher the log which we can use as a rank. In my final code I multiply this value by 10.<\/p>\n<p><code><br \/>\n[int32]$Itemrank=[math]::log($item.$property,$base)*10<br \/>\n<\/code><\/p>\n<p>I wanted the function to be able to handle any type of object, as long as it had a numeric property you could analyze. Since I assumed most people would use it on file objects, I set the default property to be Length. <\/p>\n<p><code lang=\"PowerShell\"><br \/>\nFunction Get-RankedObject {<\/p>\n<p>[cmdletbinding()]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0)]<br \/>\n[ValidateNotNullOrEmpty()]<br \/>\n[string]$Property=\"Length\",<br \/>\n[Parameter(Position=1,Mandatory=$True,HelpMessage=\"You must specify an object\",ValueFromPipeline=$True)]<br \/>\n[ValidateNotNullOrEmpty()]<br \/>\n[object[]]$InputObject,<br \/>\n[ValidateScript({$_ -gt 0 -AND $_ -le 10})]<br \/>\n[int32]$Rank=1<br \/>\n)<\/p>\n<p>Begin {<br \/>\n    Write-Verbose \"Starting $($myinvocation.myCommand)\"<br \/>\n    Write-Verbose \"Analyzing objects based on $property property\"<br \/>\n    Write-Verbose \"Writing objects to the pipeline with a ranking of at least $Rank\"<br \/>\n    #define the log base<br \/>\n    $base=1<br \/>\n    #define an empty array to hold processed objects<br \/>\n    $data=@()<br \/>\n    Write-Debug \"End of Begin script block\"<br \/>\n} #Begin<\/p>\n<p>Process {<\/p>\n<p>foreach ($item in $Inputobject) {<br \/>\n    $data+=$item<\/p>\n<p>    if ($item.$property -gt $base) {<br \/>\n        $base=$item.$property<br \/>\n        Write-Debug \"base=$base\"<br \/>\n    }          <\/p>\n<p>} #foreach<br \/>\n    Write-Debug \"End of Process script block\"<br \/>\n} #Process<\/p>\n<p>End {<br \/>\n   Write-Debug \"Processing each item in data\"<br \/>\n   Write-Verbose \"Base value is $Base\"<br \/>\n   Foreach ($item in $data) {<br \/>\n        #calculate the rank if the property value is greater than 0<br \/>\n        Write-Debug \"Ranking value $($item.$property)\"<br \/>\n        if ($item.$property -le 0) {<br \/>\n            $ItemRank=0<br \/>\n        }<br \/>\n        else {<br \/>\n            [int32]$Itemrank=[math]::log($item.$property,$base)*10<br \/>\n        }<br \/>\n        Write-Debug \"ItemRank will be $ItemRank\"<\/p>\n<p>        #add it to the item and write to pipeline if rank -ge $rank<br \/>\n        Write-Debug \"Adding Rank property to item\"<br \/>\n        $item | Add-Member -MemberType NoteProperty -Name Rank -Value $ItemRank <\/p>\n<p>        if ($item.Rank -ge $Rank) {<br \/>\n          Write-Output $item<br \/>\n        }<br \/>\n  } #foreach<\/p>\n<p>    Write-Verbose \"Processed $($data.count) objects\"<br \/>\n    Write-Verbose \"Exiting $($myinvocation.mycommand)\"<br \/>\n    Write-Debug \"End of End script block\"<\/p>\n<p>} #end<\/p>\n<p>} #end function<br \/>\n<\/code><\/p>\n<p>The assumption is that you will pipe objects into the function. If you want to rank objects on a different property, then use the -Property parameter. As each object is analyzed I add a custom property called Rank.<\/p>\n<p><code lang=\"Powershell\"><br \/>\n $item | Add-Member -MemberType NoteProperty -Name Rank -Value $ItemRank<br \/>\n<\/code><\/p>\n<p>By default the function will write all objects to the pipeline. But if you prefer, you can use the -Rank parameter to filter out objects with a low rank. For example, if you run a command using -rank 8, then only objects with a rank value of 8 and above will be written to the pipeline. Here some examples of this function in use.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.png\" alt=\"\" title=\"gro-demo1\" width=\"300\" height=\"197\" class=\"aligncenter size-medium wp-image-1915\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-1024x674.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1.png 1157w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo2-300x122.png\" alt=\"\" title=\"gro-demo2\" width=\"300\" height=\"122\" class=\"aligncenter size-medium wp-image-1916\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo2-300x122.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo2-1024x419.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo2.png 1157w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo3-300x166.png\" alt=\"\" title=\"gro-demo3\" width=\"300\" height=\"166\" class=\"aligncenter size-medium wp-image-1917\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo3-300x166.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo3-1024x568.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo3.png 1157w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Command help includes another of other examples as well. I'm sure there are a number of ways you could determine what is significant, but this approach seems to work for me and has been pretty consistent. But I hope you'll download it, try it out, and let me know. The download version will also create an alias, gro, for the function, so comment that out if you don't want to use it.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/Get-RankedObject.txt' target='_blank'>Get-RankedObject<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week on Google Plus, Hal Rottenberg posted a PowerShell idea he had. His goal was to identify a group of objects that would be statistically significant. For example, given a collection of files, group the files by size but ranked by size so that you might have a group for the largest files,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[32,347,144,98,534],"class_list":["post-1912","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-functions","tag-math","tag-objects","tag-pipeline","tag-powershell"],"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 Ranked Object &#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\/1912\/friday-fun-get-ranked-object\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun - Get Ranked Object &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Earlier this week on Google Plus, Hal Rottenberg posted a PowerShell idea he had. His goal was to identify a group of objects that would be statistically significant. For example, given a collection of files, group the files by size but ranked by size so that you might have a group for the largest files,...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-12-23T17:25:22+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.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\\\/1912\\\/friday-fun-get-ranked-object\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun &#8211; Get Ranked Object\",\"datePublished\":\"2011-12-23T17:25:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/\"},\"wordCount\":420,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/gro-demo1-300x197.png\",\"keywords\":[\"functions\",\"math\",\"objects\",\"Pipeline\",\"PowerShell\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/\",\"name\":\"Friday Fun - Get Ranked Object &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/gro-demo1-300x197.png\",\"datePublished\":\"2011-12-23T17:25:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/gro-demo1.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/gro-demo1.png\",\"width\":\"1157\",\"height\":\"762\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1912\\\/friday-fun-get-ranked-object\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun &#8211; Get Ranked Object\"}]},{\"@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 Ranked Object &#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\/1912\/friday-fun-get-ranked-object\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun - Get Ranked Object &#8226; The Lonely Administrator","og_description":"Earlier this week on Google Plus, Hal Rottenberg posted a PowerShell idea he had. His goal was to identify a group of objects that would be statistically significant. For example, given a collection of files, group the files by size but ranked by size so that you might have a group for the largest files,...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-12-23T17:25:22+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.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\/1912\/friday-fun-get-ranked-object\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun &#8211; Get Ranked Object","datePublished":"2011-12-23T17:25:22+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/"},"wordCount":420,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.png","keywords":["functions","math","objects","Pipeline","PowerShell"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/","name":"Friday Fun - Get Ranked Object &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1-300x197.png","datePublished":"2011-12-23T17:25:22+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/gro-demo1.png","width":"1157","height":"762"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1912\/friday-fun-get-ranked-object\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Friday Fun &#8211; Get Ranked Object"}]},{"@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":685,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/685\/objects-are-the-answer\/","url_meta":{"origin":1912,"position":0},"title":"Objects are the answer","author":"Jeffery Hicks","date":"July 1, 2010","format":false,"excerpt":"As I usually do, I was helping out in the forums at ScriptingAnswers.com. A member had several variables that he wanted to show as a group. As is almost always the case, the answer in PowerShell is object. I talk about this all the time in classes, conferences and online\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":4305,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4305\/what-powershell-script-was-i-working-on\/","url_meta":{"origin":1912,"position":1},"title":"What PowerShell Script Was I Working On?","author":"Jeffery Hicks","date":"March 24, 2015","format":false,"excerpt":"Last week I shared a script for finding recently modified files in a given directory. In fact, it wouldn't be that difficult to find the last files I was working on and open them in the PowerShell ISE. Assuming my Get-RecentFile function is loaded it is a simple as this:\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8593,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8593\/theres-a-file-in-my-powershell-bucket\/","url_meta":{"origin":1912,"position":2},"title":"There&#8217;s a File in My PowerShell Bucket","author":"Jeffery Hicks","date":"September 28, 2021","format":false,"excerpt":"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\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\/09\/fileage3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/fileage3.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8409,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8409\/custom-csv-import-with-powershell\/","url_meta":{"origin":1912,"position":3},"title":"Custom CSV Import with PowerShell","author":"Jeffery Hicks","date":"May 18, 2021","format":false,"excerpt":"I am always looking for opportunities to use PowerShell in a way that adds value to my work. And hopefully yours. This is one of the reasons it is worth the time and effort to learn PowerShell. It can be used in so many ways beyond the out-of-the-box commands. Once\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\/05\/importcsv-customtype.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/05\/importcsv-customtype.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/05\/importcsv-customtype.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/05\/importcsv-customtype.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4707,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4707\/a-better-powershell-more\/","url_meta":{"origin":1912,"position":4},"title":"A Better PowerShell More","author":"Jeffery Hicks","date":"December 23, 2015","format":false,"excerpt":"In PowerShell, when I have a lot of output, I can use the legacy more.com command to page the results to the screen. Get-Process | more There's not anything inherently wrong with this approach. Although one drawback is that it doesn't work in the PowerShell ISE. For that reason alone\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"More PowerShell Output","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2679,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2679\/graphing-with-the-powershell-console\/","url_meta":{"origin":1912,"position":5},"title":"Graphing with the PowerShell Console","author":"Jeffery Hicks","date":"January 9, 2013","format":false,"excerpt":"I've written before about using the PowerShell console as a graphing tool, primarily using Write-Host. Most of what I've published before were really proof of concept. I decided to try and come up with a more formal and re-usable tool that could create a horizontal bar graph based on a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"out-consolegraph-1","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1912","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=1912"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1912\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}