{"id":7680,"date":"2020-09-11T08:54:41","date_gmt":"2020-09-11T12:54:41","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7680"},"modified":"2020-09-30T15:23:38","modified_gmt":"2020-09-30T19:23:38","slug":"friday-fun-back-to-school-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/","title":{"rendered":"Friday Fun: Back to School with PowerShell"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignleft\"><img loading=\"lazy\" decoding=\"async\" width=\"175\" height=\"176\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png\" alt=\"geek-noshadow_thumb.png\" class=\"wp-image-6193\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png 175w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb-150x150.png 150w\" sizes=\"auto, (max-width: 175px) 100vw, 175px\" \/><\/figure><\/div>\n\n\n\n<p>For today's fun with PowerShell, I thought I'd share my solutions for a recent Iron Scripter challenge. If you aren't familiar with these challenges, and you should be, they are designed to test your PowerShell skills and hopefully help you learn something new. There are challenges for all skill levels and you can tackle them at your leisure. The most recent <a href=\"https:\/\/ironscripter.us\/powershell-back-to-school-scripting-challenge\/\" target=\"_blank\" rel=\"noopener noreferrer\">challenge was billed as a \"back-to-school\" event<\/a>. We were tasked with building a set of functions to solve the type of math problems you most likely faced as a child.<\/p>\n\n\n\n<p>For PowerShell beginners, you could have created mathematical expressions using the standard math operators. For example, calculate the area of a circle.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$diameter = 7\n$r = $diameter\/2\n3.14*($r*$r)<\/code><\/pre>\n\n\n\n<p>That is pretty straightforward. More experienced PowerShell scripters probably used the [Math] .NET class. There are no native cmdlets for using this class. All of its methods and properties are static. Here's the [Math] equivalent of the above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[math]::pi*[math]::pow($r,2)<\/code><\/pre>\n\n\n\n<p>How did I know what to use? Let PowerShell show you. In the console, type [math]:: and then hit Ctrl+Space. Assuming you have the standard PSReadline module loaded, you should see all of the static properties and methods.<\/p>\n\n\n\n<p>If you run the expression above you will get 38.484510006475. You might want to format that number. Yes, you could use the -f operator, but then you end up with a string. I like keeping numbers as numbers if I can. If you simply wanted a rounded integer you could do this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[math]::pi*[math]::pow($r,2) -as [int]<\/code><\/pre>\n\n\n\n<p>Or, if you want to trim decimal points, use the [Math] class and the Round() method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$raw = [math]::pi*[math]::pow($r,2)\n[math]::round($raw,2)<\/code><\/pre>\n\n\n\n<p>I split this into two steps for the sake of clarity. You could easily combine this into a single expression. Now my result is formatted to 2 decimal points and is still a number. Technically, it is a [double]. I used these techniques in my solutions, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Function Get-CircleArea {\n    [cmdletbinding()]\n    Param(\n        [parameter(Mandatory, HelpMessage = \"Enter a circle diameter between 1 and 10\")]\n        [ValidateRange(1, 10)]\n        [double]$Diameter,\n        [ValidateRange(2, 8)]\n        [int]$Decimal = 2\n    )\n\n    Write-Verbose $($myinvocation.mycommand)\n    Write-Verbose \"Calculating area of a circle with a diameter of $Diameter\"\n    $pi = [math]::pi\n    $r = $Diameter \/ 2\n    Write-Verbose \"Using a radius of $r\"\n    $area = $pi * ([math]::pow($r, 2))\n    Write-Verbose \"Raw area = $area\"\n    [pscustomobject]@{\n        PSTypename = \"PSCircleArea\"\n        Diameter   = $Diameter\n        Radius     = $r\n        Area       = [math]::round($area, $decimal)\n    }\n} #Get-CircleArea<\/code><\/pre>\n\n\n\n<p>My function writes a custom object to the pipeline.<br><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7681\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea.png\" alt=\"get-circlearea\" width=\"1078\" height=\"368\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea.png 1078w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea-300x102.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea-1024x350.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea-768x262.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-circlearea-850x290.png 850w\" sizes=\"auto, (max-width: 1078px) 100vw, 1078px\" \/><br>There's a reason I go to the effort of creating a custom object with a unique type name. Here is my solution for getting the volume of a cylinder.<br><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7682\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-no-format.png\" alt=\"get-cylindervolume-no-format\" width=\"998\" height=\"548\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-no-format.png 998w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-no-format-300x165.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-no-format-768x422.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-no-format-850x467.png 850w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/p>\n\n\n\n<p>More as a teaching opportunity than anything, I wanted to create a formatted view of this type of object. Custom formatting requires creating special ps1xml files which can be tedious. Instead, I used the <a href=\"https:\/\/github.com\/jdhitsolutions\/PSScriptTools\/blob\/master\/docs\/New-PSFormatXML.md\" target=\"_blank\" rel=\"noopener noreferrer\">New-PSFormatXML<\/a> command from the PSScriptTools module.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$new = @{\n FormatType = \"Table\" \n GroupBy = \"Form\" \n Properties = \"Diameter\",\"Radius\",\"Formatted\"\n ViewName = \"default\"\n Path  = \".\\pscylinder.format.ps1xml\"\n}\nGet-CylinderVolume -Diameter 1 -Height 1 |\nNew-PSFormatXML @new\n\nUpdate-FormatData .\\pscylinder.format.ps1xml\n<\/code><\/pre>\n\n\n\n<p>This creates the ps1xml file and then loads it into my session. Now I get the formatted result I want.<br><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7683\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-format.png\" alt=\"get-cylindervolume-format\" width=\"839\" height=\"339\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-format.png 839w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-format-300x121.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/09\/get-cylindervolume-format-768x310.png 768w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/>Because I packaged the functions into a module, I also included the formatting file and export it in the module manifest.<br>If you are wondering where you can see all of this, the module is online at <a href=\"https:\/\/github.com\/jdhitsolutions\/PSBackToSchool\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/jdhitsolutions\/PSBackToSchool<\/a>. As you look through the functions pay attention to the little things I included:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>parameter validation<\/li><li>defining aliases<\/li><li>the use of verbose messages<\/li><li>custom object creation<\/li><\/ul>\n\n\n\n<p>The whole point of the challenge is to learn and ideally have a little fun. I know I enjoyed this challenge more than I thought I would. Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For today&#8217;s fun with PowerShell, I thought I&#8217;d share my solutions for a recent Iron Scripter challenge. If you aren&#8217;t familiar with these challenges, and you should be, they are designed to test your PowerShell skills and hopefully help you learn something new. There are challenges for all skill levels and you can tackle them&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog -> Friday Fun: Back to School with #PowerShell","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[271,4,8],"tags":[224,618,221,534],"class_list":["post-7680","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell","category-scripting","tag-function","tag-iron-scripter","tag-module","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: Back to School with PowerShell &#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\/7680\/friday-fun-back-to-school-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: Back to School with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"For today&#039;s fun with PowerShell, I thought I&#039;d share my solutions for a recent Iron Scripter challenge. If you aren&#039;t familiar with these challenges, and you should be, they are designed to test your PowerShell skills and hopefully help you learn something new. There are challenges for all skill levels and you can tackle them...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-11T12:54:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-30T19:23:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.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\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: Back to School with PowerShell\",\"datePublished\":\"2020-09-11T12:54:41+00:00\",\"dateModified\":\"2020-09-30T19:23:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/\"},\"wordCount\":512,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/geek-noshadow_thumb.png\",\"keywords\":[\"Function\",\"Iron Scripter\",\"module\",\"PowerShell\"],\"articleSection\":[\"Friday Fun\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/\",\"name\":\"Friday Fun: Back to School with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/geek-noshadow_thumb.png\",\"datePublished\":\"2020-09-11T12:54:41+00:00\",\"dateModified\":\"2020-09-30T19:23:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/geek-noshadow_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/geek-noshadow_thumb.png\",\"width\":175,\"height\":176},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7680\\\/friday-fun-back-to-school-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: Back to School with PowerShell\"}]},{\"@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: Back to School with PowerShell &#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\/7680\/friday-fun-back-to-school-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: Back to School with PowerShell &#8226; The Lonely Administrator","og_description":"For today's fun with PowerShell, I thought I'd share my solutions for a recent Iron Scripter challenge. If you aren't familiar with these challenges, and you should be, they are designed to test your PowerShell skills and hopefully help you learn something new. There are challenges for all skill levels and you can tackle them...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-09-11T12:54:41+00:00","article_modified_time":"2020-09-30T19:23:38+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.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\/7680\/friday-fun-back-to-school-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: Back to School with PowerShell","datePublished":"2020-09-11T12:54:41+00:00","dateModified":"2020-09-30T19:23:38+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/"},"wordCount":512,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png","keywords":["Function","Iron Scripter","module","PowerShell"],"articleSection":["Friday Fun","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/","name":"Friday Fun: Back to School with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png","datePublished":"2020-09-11T12:54:41+00:00","dateModified":"2020-09-30T19:23:38+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/geek-noshadow_thumb.png","width":175,"height":176},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7680\/friday-fun-back-to-school-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: Back to School with PowerShell"}]},{"@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":8107,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8107\/scripting-challenge-meetup\/","url_meta":{"origin":7680,"position":0},"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":9018,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9018\/an-iron-scripter-warm-up-solution\/","url_meta":{"origin":7680,"position":1},"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":7489,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7489\/powershell-word-play\/","url_meta":{"origin":7680,"position":2},"title":"PowerShell Word Play","author":"Jeffery Hicks","date":"May 19, 2020","format":false,"excerpt":"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\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\/doublechar.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/doublechar.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7559,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7559\/an-expanded-powershell-scripting-inventory-tool\/","url_meta":{"origin":7680,"position":3},"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":8236,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8236\/solving-another-powershell-math-challenge\/","url_meta":{"origin":7680,"position":4},"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":[]},{"id":7638,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7638\/friday-fun-a-powershell-nonsense-challenge\/","url_meta":{"origin":7680,"position":5},"title":"Friday Fun &#8211; A PowerShell Nonsense Challenge","author":"Jeffery Hicks","date":"August 7, 2020","format":false,"excerpt":"Today I thought I'd share my PowerShell solution to a recent Iron Scripter challenge. The challenge was to create PowerShell code that would create nonsense documents, with a goal of creating 10 sample files filled with gibberish. Yes, other than maybe wanting some test files to work with, on its\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\/08\/nnp.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/nnp.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/nnp.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/nnp.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/nnp.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7680","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=7680"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7680\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}