{"id":867,"date":"2010-08-27T10:53:31","date_gmt":"2010-08-27T14:53:31","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=867"},"modified":"2011-03-28T08:24:19","modified_gmt":"2011-03-28T12:24:19","slug":"friday-fun-music-of-the-shell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/","title":{"rendered":"Friday Fun: Music of the Shell"},"content":{"rendered":"<p>We made it to the end of the week, and I don't know about you but I have my head buried in PowerShell work. But you know what they say about all work and no fun...so I figured I'd take a break from serious PowerShell and do something a little fun. Although, I suppose you might pick up a pointer or too along the way. This installment of Friday Fun, actually the first one, is about making beautiful music with Powershell.<!--more--><\/p>\n<p>I trust you're familiar with the `a escape sequence. If not, try this.<br \/>\n[cc lang=\"powershell\"]<br \/>\nPS C:\\> write `a<br \/>\n[\/cc]<br \/>\nWhat PowerShell is really doing is calling the Beep method of the [Console] .NET class. But there's a bit more that can be done. You can specify an frequency and a duration, in milliseconds.<br \/>\n[cc lang=\"powershell\"]<br \/>\nPS C:\\> [console]::beep(440,500)<br \/>\n[\/cc]<\/p>\n<p>In fact, given the right frequencies you can play \"music\" in PowerShell.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n$scale=@{<br \/>\nMidC=261.6<br \/>\nCSharp=277.2<br \/>\nD=293.7<br \/>\nDSharp=311.1<br \/>\nE=329.6<br \/>\nF=349.2<br \/>\nFSharp=370.0<br \/>\nG=392.0<br \/>\nGSharp=415.3<br \/>\nA=440.0<br \/>\nASharp=466.2<br \/>\nB=493.9<br \/>\nC=523.2<br \/>\n}<\/p>\n<p>#play a chromatic scale<br \/>\nwrite-host \"First octave\" -ForegroundColor Cyan<br \/>\n$scale.values | sort | foreach {[console]::beep($_,125)}<br \/>\n[\/cc]<br \/>\nOr, you can be more avant-garde and listen to the music of chaos. I put together a script that plays a set number of notes with a random frequency and of random duration.<br \/>\n[cc lang=\"Powershell\"]<br \/>\n#requires -version 2.0<\/p>\n<p>#usage: music.ps1 64<\/p>\n<p>Param([int]$Length=16)<\/p>\n<p>#function to create the musical tones<br \/>\nFunction Make-Music {<\/p>\n<p>    Param(<br \/>\n    [Parameter(Position=0, ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]<br \/>\n    [int]$frequency=400,<br \/>\n    [Parameter(Position=1, ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]<br \/>\n    [int]$duration=500)<\/p>\n<p>    Process {<br \/>\n        [console]::Beep($frequency,$duration)<br \/>\n    }<br \/>\n} #function<\/p>\n<p>Write-Host \"Generating a $length note sequence\" -ForegroundColor Cyan<\/p>\n<p>$notes=for ($i=1;$i -le $length;$i++) {<br \/>\n $f=Get-Random -Minimum 500 -Maximum 2500<br \/>\n $r=Get-Random -Minimum 1 -Maximum 10<br \/>\n New-Object -TypeName PSObject -Property @{<br \/>\n    Frequency=$f<br \/>\n    Duration=$r*125<br \/>\n    }<br \/>\n} #for<\/p>\n<p>$notes | make-music<\/p>\n<p>$a=Read-Host \"Do you want to save this to an XML file? [YN]\"<br \/>\nif ($a -match \"^Y$\") {<br \/>\n    $file=Read-Host \"Enter a filename or press Enter to cancel.\"<br \/>\n    if ($file) {<br \/>\n        $notes | Export-Clixml -Path $file<br \/>\n    }<br \/>\n}<br \/>\n[\/cc]<br \/>\nThe script takes an integer for the length of the \"musical\" sequence. I used a For construct to create a series of custom objects with a frequency and duration.<br \/>\n[cc lang=\"powershell\"]<br \/>\n$notes=for ($i=1;$i -le $length;$i++) {<br \/>\n $f=Get-Random -Minimum 500 -Maximum 2500<br \/>\n $r=Get-Random -Minimum 1 -Maximum 10<br \/>\n New-Object -TypeName PSObject -Property @{<br \/>\n    Frequency=$f<br \/>\n    Duration=$r*125<br \/>\n    }<br \/>\n} #for<br \/>\n[\/cc]<br \/>\nThis collection of objects is then piped to a nested function that can accept pipelined input which generates the sequence. If you like what you hear you can also export the sequence to an XML file. You'll be prompted for a file name. With the XML \"score\" you can play your \"music\" at any time, assuming you've loaded the Make-Music function into your shell.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> import-clixml c:\\work\\opus1.xml | Make-Music<br \/>\n[\/cc]<br \/>\nYou can download a zip file with everything you need to get started <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/PSMusicFiles.zip'>here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We made it to the end of the week, and I don&#8217;t know about you but I have my head buried in PowerShell work. But you know what they say about all work and no fun&#8230;so I figured I&#8217;d take a break from serious PowerShell and do something a little fun. Although, I suppose 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":"","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":[271,61,4],"tags":[534],"class_list":["post-867","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-miscellaneous","category-powershell","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: Music of the Shell &#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\/867\/friday-fun-music-of-the-shell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: Music of the Shell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"We made it to the end of the week, and I don&#039;t know about you but I have my head buried in PowerShell work. But you know what they say about all work and no fun...so I figured I&#039;d take a break from serious PowerShell and do something a little fun. Although, I suppose you...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-08-27T14:53:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-03-28T12:24:19+00:00\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: Music of the Shell\",\"datePublished\":\"2010-08-27T14:53:31+00:00\",\"dateModified\":\"2011-03-28T12:24:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/\"},\"wordCount\":492,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"PowerShell\"],\"articleSection\":[\"Friday Fun\",\"Miscellaneous\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/\",\"name\":\"Friday Fun: Music of the Shell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2010-08-27T14:53:31+00:00\",\"dateModified\":\"2011-03-28T12:24:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/867\\\/friday-fun-music-of-the-shell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: Music of the Shell\"}]},{\"@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: Music of the Shell &#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\/867\/friday-fun-music-of-the-shell\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: Music of the Shell &#8226; The Lonely Administrator","og_description":"We made it to the end of the week, and I don't know about you but I have my head buried in PowerShell work. But you know what they say about all work and no fun...so I figured I'd take a break from serious PowerShell and do something a little fun. Although, I suppose you...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-08-27T14:53:31+00:00","article_modified_time":"2011-03-28T12:24:19+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: Music of the Shell","datePublished":"2010-08-27T14:53:31+00:00","dateModified":"2011-03-28T12:24:19+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/"},"wordCount":492,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["PowerShell"],"articleSection":["Friday Fun","Miscellaneous","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/","name":"Friday Fun: Music of the Shell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2010-08-27T14:53:31+00:00","dateModified":"2011-03-28T12:24:19+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/867\/friday-fun-music-of-the-shell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: Music of the Shell"}]},{"@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":1307,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1307\/friday-fun-powershell-pep-talk\/","url_meta":{"origin":867,"position":0},"title":"Friday Fun PowerShell Pep Talk","author":"Jeffery Hicks","date":"April 1, 2011","format":false,"excerpt":"Today's Friday Fun is meant to help get you excited about the upcoming Scripting Games. I want to add a little pep to your PowerShell prompt. Perhaps it will even keep you motivated. What I have for you today are variety of prompt functions. Consider them variations on a theme.\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"PowerShell Pep Talk","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/04\/color-pep-prompt-300x144.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1554,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1554\/friday-fun-powershell-powerball-numbers\/","url_meta":{"origin":867,"position":1},"title":"Friday Fun PowerShell PowerBall Numbers","author":"Jeffery Hicks","date":"July 8, 2011","format":false,"excerpt":"Like many of you, I dream about hitting the lottery and retiring to live the good life. Unfortunately I rarely play so I guess my odds are winning are pretty slim. But for the latest installment of Friday Fun, I thought I would have PowerShell help me pick some numbers\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1136,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1136\/friday-fun-snappy-shortcuts\/","url_meta":{"origin":867,"position":2},"title":"Friday Fun &#8211; Snappy Shortcuts","author":"Jeffery Hicks","date":"February 11, 2011","format":false,"excerpt":"In one of my recent Prof. PowerShell columns, I wrote about using the Wscript.Shell VBScript object in PowerShell to retrieve special folder paths. Another handy trick is the ability to create shortcut links to either file or web resources. Let me show you how to accomplish this in PowerShell and\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/create-shortcuts-300x185.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1389,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1389\/friday-fun-randomness-abounds\/","url_meta":{"origin":867,"position":3},"title":"Friday Fun Randomness Abounds","author":"Jeffery Hicks","date":"April 29, 2011","format":false,"excerpt":"I find it a little ironic that although I like efficiency, structure and order I'm fascinated with randomness. In today's Friday Fun I want to explore a few ways you might incorporate randomness into your PowerShell scripting. Perhaps you need a random number between 100 and 500. Or a string\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":904,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/904\/friday-fun-color-my-world\/","url_meta":{"origin":867,"position":4},"title":"Friday Fun: Color My World","author":"Jeffery Hicks","date":"September 3, 2010","format":false,"excerpt":"The end of another work week and time for a little PowerShell fun. When I first started using PowerShell, I was fascinated by Write-Host and the ability to write colorized text to the console. Visions of ANSI art danced in my head, but I've moved on. Using colors with Write-Host\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/09\/color-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/09\/color-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/09\/color-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1567,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1567\/friday-fun-re-run-last-command\/","url_meta":{"origin":867,"position":5},"title":"Friday Fun Re-Run Last Command","author":"Jeffery Hicks","date":"July 29, 2011","format":false,"excerpt":"Ok, I'll be the first to admit you might not find a production use for this tip, but that's what makes it fun. Interactively, you can always hit the up arrow to get the last command in your command buffer. But what if you are running a script and for\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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/867","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=867"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/867\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}