{"id":4039,"date":"2014-09-22T08:28:15","date_gmt":"2014-09-22T12:28:15","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=4039"},"modified":"2014-09-22T08:28:15","modified_gmt":"2014-09-22T12:28:15","slug":"sorting-hash-tables","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/","title":{"rendered":"Sorting Hash Tables"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-2881\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.png\" alt=\"letterjumble\" width=\"150\" height=\"150\" \/><\/a>Over the weekend I received a nice comment from a reader who came across an old post of mine on turning an <a title=\"read about the revised function\" href=\"http:\/\/jdhitsolutions.com\/blog\/2013\/01\/convert-powershell-object-to-hashtable-revised\/\" target=\"_blank\">object into a hash table<\/a>.\u00a0 He wanted to add a comment but my blog closes comments after a period of time. But I thought it was worth sharing, especially for those of you still getting started with PowerShell. The comment was on how to sort a hash table.<\/p>\n<p>Let's say you have a simple hash table like this:<\/p>\n<pre class=\"lang:ps decode:true \">$hash = @{\r\nName=\"Jeff\"\r\nSize = 123\r\nColor = \"Green\"\r\nComputer = \"Yoga2Pro\"\r\n}<\/pre>\n<p>And is displayed like this:<\/p>\n<pre class=\"lang:batch decode:true \">PS C:\\scripts&gt; $hash\r\n\r\nName                           Value\r\n----                           -----\r\nColor                          Green\r\nName                           Jeff\r\nComputer                       Yoga2Pro\r\nSize                           123<\/pre>\n<p>To sort on the keys, you can use the GetEnumerator() method which is part of every hash table object. This method creates a System.Collections.DictionaryEntry object for each item in the hash table.<\/p>\n<pre class=\"lang:batch decode:true \">PS C:\\scripts&gt; $hash.GetEnumerator()  | get-member\r\n\r\n\r\n   TypeName: System.Collections.DictionaryEntry\r\n\r\nName        MemberType    Definition\r\n----        ----------    ----------\r\nName        AliasProperty Name = Key\r\nEquals      Method        bool Equals(System.Object obj)\r\nGetHashCode Method        int GetHashCode()\r\nGetType     Method        type GetType()\r\nToString    Method        string ToString()\r\nKey         Property      System.Object Key {get;set;}\r\nValue       Property      System.Object Value {get;set;}<\/pre>\n<p>This means you can sort on any property.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\scripts&gt; $hash.GetEnumerator() | sort key\r\n\r\nName                           Value\r\n----                           -----\r\nColor                          Green\r\nComputer                       Yoga2Pro\r\nName                           Jeff\r\nSize                           123\r\n\r\n\r\nPS C:\\scripts&gt; $hash.GetEnumerator() | sort value\r\n\r\nName                           Value\r\n----                           -----\r\nSize                           123\r\nColor                          Green\r\nName                           Jeff\r\nComputer                       Yoga2Pro<\/pre>\n<p>By the way, starting in PowerShell 3.0, you could \"pre-sort\" the hash table by defining it as 'ordered'.<\/p>\n<pre class=\"lang:ps decode:true \" >$hash = [ordered]@{\r\nName=\"Jeff\"\r\nComputer = \"Yoga2Pro\"\r\nColor = \"Green\"\r\nSize = 123\r\n}<\/pre>\n<p>Now the hash table will always be sorted in the order you defined the entries.<\/p>\n<pre class=\"lang:batch decode:true \" >PS C:\\scripts&gt; $hash\r\n\r\nName                           Value\r\n----                           -----\r\nName                           Jeff\r\nComputer                       Yoga2Pro\r\nColor                          Green\r\nSize                           123<\/pre>\n<p>Although, if you want to sort you still can.<\/p>\n<pre class=\"lang:batch decode:true \" >PS C:\\scripts&gt; $hash.GetEnumerator() | sort name -Descending\r\n\r\nName                           Value\r\n----                           -----\r\nSize                           123\r\nName                           Jeff\r\nComputer                       Yoga2Pro\r\nColor                          Green<\/pre>\n<p>Have a great week and I hope you get things sorted out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the weekend I received a nice comment from a reader who came across an old post of mine on turning an object into a hash table.\u00a0 He wanted to add a comment but my blog closes comments after a period of time. But I thought it was worth sharing, especially for those of you&#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":"Monday morning blog: Sorting #PowerShell Hash Tables","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":[199,534,540],"class_list":["post-4039","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-hashtable","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>Sorting Hash Tables &#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\/4039\/sorting-hash-tables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sorting Hash Tables &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Over the weekend I received a nice comment from a reader who came across an old post of mine on turning an object into a hash table.\u00a0 He wanted to add a comment but my blog closes comments after a period of time. But I thought it was worth sharing, especially for those of you...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-22T12:28:15+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.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=\"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\\\/4039\\\/sorting-hash-tables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Sorting Hash Tables\",\"datePublished\":\"2014-09-22T12:28:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/\"},\"wordCount\":184,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/03\\\/letterjumble-150x150.png\",\"keywords\":[\"hashtable\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/\",\"name\":\"Sorting Hash Tables &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/03\\\/letterjumble-150x150.png\",\"datePublished\":\"2014-09-22T12:28:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/03\\\/letterjumble.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/03\\\/letterjumble.png\",\"width\":364,\"height\":360},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4039\\\/sorting-hash-tables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sorting Hash Tables\"}]},{\"@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":"Sorting Hash Tables &#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\/4039\/sorting-hash-tables\/","og_locale":"en_US","og_type":"article","og_title":"Sorting Hash Tables &#8226; The Lonely Administrator","og_description":"Over the weekend I received a nice comment from a reader who came across an old post of mine on turning an object into a hash table.\u00a0 He wanted to add a comment but my blog closes comments after a period of time. But I thought it was worth sharing, especially for those of you...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-09-22T12:28:15+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.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":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Sorting Hash Tables","datePublished":"2014-09-22T12:28:15+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/"},"wordCount":184,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.png","keywords":["hashtable","PowerShell","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/","name":"Sorting Hash Tables &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.png","datePublished":"2014-09-22T12:28:15+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble.png","width":364,"height":360},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4039\/sorting-hash-tables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Sorting Hash Tables"}]},{"@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":2062,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2062\/export-and-import-hash-tables\/","url_meta":{"origin":4039,"position":0},"title":"Export and Import Hash Tables","author":"Jeffery Hicks","date":"February 2, 2012","format":false,"excerpt":"I use hash tables quite a bit and with the impending arrival of PowerShell 3.0 I expect even more so. PowerShell v3 allows you to define a hash table of default parameter values. I'm not going to to cover that feature specifically, but it made me realize I needed a\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":1301,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/","url_meta":{"origin":4039,"position":1},"title":"Get File Hash","author":"Jeffery Hicks","date":"March 31, 2011","format":false,"excerpt":"The other day I had the need to calculate MD5 file hashes in order to compare files. The PowerShell Community Extensions has a nifty cmdlet, Get-Hash, that does exactly that. Unfortunately, sometimes even free tools like this aren't an option, as in the case of my client. Or they don't\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":2613,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2613\/create-powershell-scripts-with-a-single-command\/","url_meta":{"origin":4039,"position":2},"title":"Create PowerShell Scripts with a Single Command","author":"Jeffery Hicks","date":"December 5, 2012","format":false,"excerpt":"One of the drawbacks to using a PowerShell script or function is that you have to write it. For many IT Pros, especially those new to PowerShell, it can be difficult to know where to start. I think more people would write their own tools if there was an easy\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\/2011\/10\/talkbubble-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1701,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1701\/friday-fun-convert-object-to-hash-table\/","url_meta":{"origin":4039,"position":3},"title":"Friday Fun Convert Object to Hash Table","author":"Jeffery Hicks","date":"October 21, 2011","format":false,"excerpt":"I've been working on a few PowerShell projects recently and one requirement I had was to turn an object into a hash table. I thought this was something that was already handled in PowerShell but I couldn't find a cmdlet or an easy .NET technique. So I wrote my own\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":1814,"url":"https:\/\/jdhitsolutions.com\/blog\/google-plus\/1814\/re-use-powershell-scriptblocks-i-commented\/","url_meta":{"origin":4039,"position":4},"title":"Re-Use PowerShell Scriptblocks","author":"Jeffery Hicks","date":"October 24, 2011","format":false,"excerpt":"\/\/Re-Use PowerShell Scriptblocks\/\/I commented on a blog post today that showed how to use a hash table with Select-Object to format file sizes say as KB.dir $env:temp -rec | select fullname,@{Name=\"KB\";Expression={$_.length\/1kb}}Since you most likely will want to use something similar for other directories, don't feel you have to re-invent the\u2026","rel":"","context":"In &quot;Google Plus&quot;","block_context":{"text":"Google Plus","link":"https:\/\/jdhitsolutions.com\/blog\/category\/google-plus\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1716,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1716\/convert-text-to-object\/","url_meta":{"origin":4039,"position":5},"title":"Convert Text to Object","author":"Jeffery Hicks","date":"October 25, 2011","format":false,"excerpt":"Today I have another tool in my new battle regarding turning command line tools into PowerShell tools. The bottom line is we want to have objects written to the pipeline. At the PowerShell Deep Dive in Frankfurt there was a suggestion about providing tools to help with the transformation from\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4039","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=4039"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4039\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}