{"id":7489,"date":"2020-05-19T09:43:53","date_gmt":"2020-05-19T13:43:53","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7489"},"modified":"2020-05-19T09:43:53","modified_gmt":"2020-05-19T13:43:53","slug":"powershell-word-play","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/","title":{"rendered":"PowerShell Word Play"},"content":{"rendered":"<p>A few weeks ago an Iron Scripter PowerShell challenge was issued that <a href=\"https:\/\/ironscripter.us\/a-powershell-word-play-challenge\/\" target=\"_blank\" rel=\"noopener noreferrer\">involved playing with words and characters.<\/a> Remember, the Iron Scripter challenges aren't intended to create meaningful, production worthy code. They are designed to help you learn PowerShell fundamentals and scripting techniques. This particular challenge was aimed at beginner and intermediate experience levels. I have my own solutions to share, but they are not necessarily the only solution or even the best.<\/p>\n<h2>Beginner<\/h2>\n<p>The beginner challenge wanted you take a string and calculate the sum of its character values. Of course you first need a string.<\/p>\n<pre>$w = \"PowerShell Iron Scripter\"<\/pre>\n<p>Each letter is actually represented by a [CHAR]. Technically the string is an array of System.Char objects. If you run:<\/p>\n<pre>$w[0] | Get-Member<\/pre>\n<p>You can verify this.\u00a0 $w[0] is the first element in the array of characters.<\/p>\n<p>What isn't especially clear, is that this object has an underlying integer value. Try this:<\/p>\n<pre>$w[0] -as [int]<\/pre>\n<p>This command tells PowerShell to treat the object, $w[0] AS an integer. You should get a value back of 80. In fact, if you run this:<\/p>\n<pre>[char]80<\/pre>\n<p>You should get a result of P. By the way, you could also have calculated the integer value this way:<\/p>\n<pre> $w[0].ToInt32($null)<\/pre>\n<p>But this is not something I would expect a beginner to know.<\/p>\n<p>With this knowledge it is time to calculate the total sum of all characters. Hopefully you know about Measure-Object.\u00a0 You can do a quick test with a single character.<\/p>\n<pre>$w[0] | Measure-Object -sum<\/pre>\n<p>You should see a Sum value of 80. Make sure you understand this pattern. You are telling PowerShell, \"Take all of the characters to the left of the pipe (|) and send them to Measure-Object. Have the cmdlet get the sum. There is no need to specify a property because the [CHAR] object doesn't really have any. Once you recognize this pattern it is easy to take this to the next step to\u00a0 turn the string into an character array. If you pipe $w to Get-Member you'll see this method.<\/p>\n<pre>$w.toCharArray()<\/pre>\n<p>On the screen, PowerShell will display the values as something you can read. But you can actually send this array to Measure-Object per the pattern you discovered a moment ago.<\/p>\n<pre>$w.toCharArray() | Measure-Object -sum | Select-Object -property Sum<\/pre>\n<p>I took this the next step to pipe the measurement object result to Select-Object to display only the Sum property. When you run this you'll still get an object with a single property, Sum. If you only want the value, you can tell Select-Object to expand the property.<\/p>\n<pre>$w.toCharArray() | Measure-Object -sum | Select-Object -expandproperty Sum<\/pre>\n<p>You should have been able to discover this by reading the help and examples for Select-Object.<\/p>\n<p>Once you get your head around the PowerShell pipeline, you can simplify the command to this:<\/p>\n<pre>($w.ToCharArray() | Measure-Object -sum).sum<\/pre>\n<p>You are telling PowerShell, run the code inside the parentheses (which you can do so you can see what is happening) and then display the Sum property of that object.\u00a0 Using my text in $w you should get a sum total of 2345.<\/p>\n<p>The second part of the beginner challenge was to turn the array into a string of their integer values. You already know how to create the array. The next step is to display them as their integer values.<\/p>\n<pre>$w.ToCharArray() | ForEach-Object {$_ -as [int] }<\/pre>\n<p>This creates another array. To join them together you can use the -Join operator, which you could have found by searching for help.<\/p>\n<pre>help join<\/pre>\n<p>Using the nested pipeline pattern from above, converting the text into string of corresponding integer values can be done with a one-line command.<\/p>\n<pre>($w.ToCharArray() | ForEach-Object {$_ -as [int] }) -join \" \"<\/pre>\n<p>Or you could use this slightly advanced alternative.<\/p>\n<pre>[int[]]$w.ToCharArray() -join \" \"<\/pre>\n<p>This command is telling PowerShell to turn the results of the ToCharArray() method into an array of integers. Then join that result with a space between each value.<\/p>\n<p>If you are running PowerShell 7, you have another option and that is a cmdlet called Join-String.<\/p>\n<pre>[int[]]$w.ToCharArray() | Join-String -Separator \" \"<\/pre>\n<h2>Intermediate<\/h2>\n<p>The next level challenge was to take this knowledge and write a set of functions to create strings using double the character value. Let's start with a new string of text.<\/p>\n<pre>$t = \"Today, I am a PowerShell Iron Scripter!\"<\/pre>\n<p>Here is some proof of concept code.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$c = $t.ToCharArray() | ForEach-Object -begin {$out = @()} -process {\n    $val = [int]([char]$_)\n    $nval = $val*2\n    $out += [char]$nval\n} -end { $out -join \"\"}\n<\/pre>\n<p>The first part of this is similar to what you did as a beginner. The array is piped to ForEach-Object. Most of you are probably used to running this with a single scriptblock, which is the process scriptblock. Code runs once for every piped in object using $_ as a placeholder to indicate the current object. But there are also Begin and End scriptblocks. In the Begin block, you can define an arrary, $out. This is done once before any pipeline processing is done. In the process block, the [CHAR] object's integer value is retrieved. A new value is calculated by multiplying by 2 and this new value is then converted back to a [CHAR] which is added to the array.\u00a0 Eventually, you'll have enough experience to reduce these several lines of code into one but I wanted to make sure you could visualize what is happening. The code in the End scriptlbock runs once after everything in the pipeline has been processed. You can join the values. These script blocks are the same that you use when creating an advanced PowerShell function.<\/p>\n<p>You should get an odd-looking result.<\/p>\n<pre>\u00a8\u00de\u00c8\u00c2\u00f2X@\u0092@\u00c2\u00da@\u00c2@\u00a0\u00de\u00ee\u00ca\u00e4\u00a6\u00d0\u00ca\u00d8\u00d8@\u0092\u00e4\u00de\u00dc@\u00a6\u00c6\u00e4\u00d2\u00e0\u00e8\u00ca\u00e4B<\/pre>\n<p>Depending on the [CHAR] values you might even get non-printing characters. To reverse the process is merely a matter of taking each [CHAR] integer value and divide by 2.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$c.ToCharArray() | ForEach-Object -begin {$out = @()} -process {\n    $val = [int]([char]$_)\n    $nval = $val\/2\n    $out += [char]$nval\n} -end { $out -join \"\"}\n<\/pre>\n<p>This will output the original string. Now that you have working code, you can build functions around them.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Function ConvertTo-DoubleChar {\n    [cmdletbinding()]\n    Param(\n        [Parameter(Mandatory, ValueFromPipeline)]\n        [string]$Text\n    )\n\n    Begin {\n        Write-Verbose \"[BEGIN  ] Starting: $($MyInvocation.Mycommand)\"\n    } #begin\n\n    Process {\n        Write-Verbose \"[PROCESS] Converting $text\"\n\n        $Text.ToCharArray() | ForEach-Object -begin {\n            $out = @()\n        } -process {\n            $val = [int]([char]$_)\n            $nval = $val*2\n            $out += [char]$nval\n        } -end {\n            $converted  = $out -join \"\"\n        }\n        Write-Verbose \"[PROCESS] to $converted\"\n        $converted\n    } #process\n    End {\n        Write-Verbose \"[END    ] Ending: $($MyInvocation.Mycommand)\"\n    } #end\n}\n\nFunction ConvertFrom-DoubleChar {\n    [cmdletbinding()]\n    Param(\n        [Parameter(Mandatory, ValueFromPipeline)]\n        [string]$Text\n    )\n\n    Begin {\n        Write-Verbose \"[BEGIN  ] Starting: $($MyInvocation.Mycommand)\"\n    } #begin\n\n    Process {\n        Write-Verbose \"[PROCESS] Converting $text\"\n\n        $Text.ToCharArray() | ForEach-Object -begin {\n            $out = @()\n        } -process {\n            $val = [int]([char]$_)\n            $nval = $val\/2\n            $out += [char]$nval\n        } -end {\n            $out -join \"\"\n        }\n    } #process\n    End {\n        Write-Verbose \"[END    ] Ending: $($MyInvocation.Mycommand)\"\n    } #end\n}\n<\/pre>\n<p>Let's do a \"round-trip\" test.<\/p>\n<pre>\"PowerShell is wicked fun!\" | ConvertTo-DoubleChar -OutVariable in | ConvertFrom-DoubleChar<\/pre>\n<p>If the functions are designed properly the plain text string is converted to its double [CHAR] version which is then converted back.<\/p>\n<pre>PS C:\\&gt; \"PowerShell is wicked fun!\" | ConvertTo-DoubleChar -OutVariable in | ConvertFrom-DoubleChar\nPowerShell is wicked fun!<\/pre>\n<p>To double validate, my example is using the common parameter OutVariable to save the results from ConvertTo-DoubleChar.<\/p>\n<pre>PS C:\\&gt; $in\n\u00a0\u00de\u00ee\u00ca\u00e4\u00a6\u00d0\u00ca\u00d8\u00d8@\u00d2\u00e6@\u00ee\u00d2\u00c6\u00d6\u00ca\u00c8@\u00cc\u00ea\u00dcB\n\nPS C:\\&gt; ConvertFrom-DoubleChar $in\nPowerShell is wicked fun!<\/pre>\n<p>Here's another example piping multiple strings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7491\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png\" alt=\"doublechar\" width=\"1584\" height=\"445\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png 1584w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar-300x84.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar-1024x288.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar-768x216.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar-1536x432.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar-850x239.png 850w\" sizes=\"auto, (max-width: 1584px) 100vw, 1584px\" \/><\/p>\n<p>As I mentioned at the beginning, these are not the only solutions. There are no short cuts to learning PowerShell. You need to get in the habit of reading help. Develop patterns and practices that you can re-use. Once you are comfortable with the fundamentals, it doesn't matter if you are working with a character object or a service or an Azure virtual machine.<\/p>\n<p>If you have any questions on what I've come up with, please ask them in the comments.<\/p>\n<h2>Learn More<\/h2>\n<p>If you are looking for more ways to test and teach yourself PowerShell, I encourage you to grab a copy of <a href=\"https:\/\/leanpub.com\/psprimer\" target=\"_blank\" rel=\"noopener noreferrer\">The PowerShell Practice Primer<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago an Iron Scripter PowerShell challenge was issued that involved playing with words and characters. Remember, the Iron Scripter challenges aren&#8217;t intended to create meaningful, production worthy code. They are designed to help you learn PowerShell fundamentals and scripting techniques. This particular challenge was aimed at beginner and intermediate experience levels. I&#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":"Just posted: #PowerShell Word Play - An Iron Scripter Solution","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":[618,534,540],"class_list":["post-7489","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-iron-scripter","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>PowerShell Word Play &#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\/7489\/powershell-word-play\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell Word Play &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"A few weeks ago an Iron Scripter PowerShell challenge was issued that involved playing with words and characters. Remember, the Iron Scripter challenges aren&#039;t intended to create meaningful, production worthy code. They are designed to help you learn PowerShell fundamentals and scripting techniques. This particular challenge was aimed at beginner and intermediate experience levels. I...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-19T13:43:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell Word Play\",\"datePublished\":\"2020-05-19T13:43:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/\"},\"wordCount\":1054,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/doublechar.png\",\"keywords\":[\"Iron Scripter\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/\",\"name\":\"PowerShell Word Play &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/doublechar.png\",\"datePublished\":\"2020-05-19T13:43:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/doublechar.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/doublechar.png\",\"width\":1584,\"height\":445},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7489\\\/powershell-word-play\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell Word Play\"}]},{\"@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":"PowerShell Word Play &#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\/7489\/powershell-word-play\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell Word Play &#8226; The Lonely Administrator","og_description":"A few weeks ago an Iron Scripter PowerShell challenge was issued that involved playing with words and characters. Remember, the Iron Scripter challenges aren't intended to create meaningful, production worthy code. They are designed to help you learn PowerShell fundamentals and scripting techniques. This particular challenge was aimed at beginner and intermediate experience levels. I...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-05-19T13:43:53+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell Word Play","datePublished":"2020-05-19T13:43:53+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/"},"wordCount":1054,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png","keywords":["Iron Scripter","PowerShell","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/","name":"PowerShell Word Play &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png","datePublished":"2020-05-19T13:43:53+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png","width":1584,"height":445},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell Word Play"}]},{"@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":9018,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9018\/an-iron-scripter-warm-up-solution\/","url_meta":{"origin":7489,"position":0},"title":"An Iron Scripter Warm-Up Solution","author":"Jeffery Hicks","date":"May 6, 2022","format":false,"excerpt":"We just wrapped up the 2022 edition of the PowerShell+DevOps Global Summit. It was terrific to be with passionate PowerShell professionals again. The culmination of the event is the Iron Scripter Challenge. You can learn more about this year's event and winner here. But there is more to the Iron\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":8107,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8107\/scripting-challenge-meetup\/","url_meta":{"origin":7489,"position":1},"title":"Scripting Challenge Meetup","author":"Jeffery Hicks","date":"February 1, 2021","format":false,"excerpt":"As you probably know, I am the PowerShell problem master behind the challenges from the Iron Scripter site. Solving a PowerShell scripting challenge is a great way to test your skills and expand your knowledge. The final result is merely a means to an end. How you get there and\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\/02\/rubik.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":7559,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7559\/an-expanded-powershell-scripting-inventory-tool\/","url_meta":{"origin":7489,"position":2},"title":"An Expanded PowerShell Scripting Inventory Tool","author":"Jeffery Hicks","date":"June 19, 2020","format":false,"excerpt":"The other day I shared my code that I worked up to solve an Iron Scripter PowerShell challenge. One of the shortcomings was that I didn't address a challenge to include a property that would indicate what file was using a given command. I also felt I could do better\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\/get-psscriptinventory.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/get-psscriptinventory.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/get-psscriptinventory.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/get-psscriptinventory.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/get-psscriptinventory.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/get-psscriptinventory.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7471,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7471\/a-powershell-network-monitor\/","url_meta":{"origin":7489,"position":3},"title":"A PowerShell Network Monitor","author":"Jeffery Hicks","date":"May 12, 2020","format":false,"excerpt":"I hope you've been trying your hand at the scripting challenges being posted on the Iron Scripter website. The challenges are designed for individuals to do on their own to build up their PowerShell scripting skills. A few weeks ago, a challenge was posted to create a network monitoring tool\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\/05\/netperf-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/netperf-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/netperf-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/netperf-2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/netperf-2.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":7576,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7576\/answering-the-powershell-word-to-phone-challenge\/","url_meta":{"origin":7489,"position":4},"title":"Answering the PowerShell Word to Phone Challenge","author":"Jeffery Hicks","date":"July 7, 2020","format":false,"excerpt":"A few weeks ago, the Iron Scripter challenge was to write code to convert a short string into its numeric valuesusing the alphabet as it is laid out on a telephone.\u00a0 A number of solutions have already been shared in the comments on the original post. There are certainly a\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\/07\/phone6.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/phone6.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/phone6.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/phone6.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/phone6.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":8236,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8236\/solving-another-powershell-math-challenge\/","url_meta":{"origin":7489,"position":5},"title":"Solving Another PowerShell Math Challenge","author":"Jeffery Hicks","date":"March 22, 2021","format":false,"excerpt":"Last month, the Iron Scripter Chairman posted a \"fun\" PowerShell scripting challenge. Actually, a few math-related challenges . As with all these challenges, the techniques and concepts you use to solve the challenge are more important than the result itself. Here's how I approached the problems. Problem #1 The first\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\/03\/get-possiblesum.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/get-possiblesum.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/get-possiblesum.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7489","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=7489"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7489\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}