{"id":7502,"date":"2020-05-29T12:44:09","date_gmt":"2020-05-29T16:44:09","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7502"},"modified":"2020-10-01T11:55:29","modified_gmt":"2020-10-01T15:55:29","slug":"show-ansi-samples","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/","title":{"rendered":"Show ANSI Samples"},"content":{"rendered":"\n<p>Earlier this week I did a <a href=\"https:\/\/www.twitch.tv\/videos\/632597030\" target=\"_blank\" rel=\"noopener noreferrer\">live session<\/a> for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions.&nbsp; One of things I talked about was using ANSI escape sequences&nbsp; to add some color.&nbsp; What I realized was that I was constantly referring to my reference source at <a href=\"https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code<\/a>.&nbsp; That's good up to a point, but I still need to see what a value looks like in my console to know if I want to use it. I don't know why I didn't do this sooner but I wrote a quick and dirty script to display ANSI sequences from a PowerShell prompt. There are others in the wild if you don't like this one.<\/p>\n\n\n\n<pre title=\"Show-ANSI.ps1\" class=\"wp-block-code lang:ps mark:0 decode:true\"><code lang=\"powershell\" class=\"language-powershell\">#requires -version 5.1\n#requires -module PSScriptTools\n\n#Show-ANSI.ps1\n#comment out the Add-Border lines if you aren't using the PSScriptTools module.\n[cmdletbinding()]\nParam(\n    [switch]$Basic,\n    [switch]$Foreground,\n    [switch]$Background,\n    [int[]]$RGB\n)\n\n# a private function to display results in columns on the screen\nFunction display {\nParam([object]$all,[int]$Max)\n\n    $c = 1\n    for ($i=0;$i -le $all.count;$i++) {\n        if ($c -gt $max) {\n            Write-Host \"`r\"\n            $c=1\n        }\n        Write-Host \"$($all[$i]) `t\" -NoNewline\n        $c++\n    }\n}\n\nif ($IsCoreCLR) {\n    $esc = \"`e\"\n    $escText = '`e'\n    $max = 3\n}\nelse {\n    $esc = $([char]0x1b)\n    $escText = '$([char]0x1b)'\n    $max = 2\n}\n\n#basic\nif ($basic) {\n\n    Add-Border \"Basic Sequences\" -ansitext \"$esc[1m\"\n\n    $basichash = @{\n        1 = \"Bold\"\n        2 = \"Faint\"\n        3 = \"Italic\"\n        4 = \"Underline\"\n        5 = \"SlowBlink\"\n        6 = \"RapidBlink\"\n        7 = \"Reverse\"\n        9 = \"CrossedOut\"\n    }\n\n    $basichash.GetEnumerator() | ForEach-Object {\n        $sequence = \"$esctext[$($_.name)m$($_.value)$esctext[0m\"\n        #\"$esc[$($_.name)m$($_.value)$esc[0m\"\n        \"$esc[$($_.name)m$sequence$esc[0m\"\n    }\n}\n\nIf ($Foreground) {\n\n    Add-Border \"Foreground\" -ansitext \"$esc[93m\"\n    $n = 30..37\n    $n+= 90..97\n\n    $all = $n | ForEach-Object {\n         $sequence = \"$esctext[$($_)mHello$esctext[0m\"\n        \"$esc[$($_)m$sequence$esc[0m\"\n    }\n\n    display -all $all -Max $max\n\n    Write-Host \"`n\"\n    Add-Border \"8-Bit Foreground\" -ansitext \"$esc[38;5;10m\"\n    $all = 1..255 | ForEach-Object {\n         $sequence = \"$esctext[38;5;$($_)mHello$esctext[0m\"\n        \"$esc[38;5;$($_)m$sequence$esc[0m\"\n    }\n      display -all $all -Max $max\n}\n\nIf ($Background) {\n\n    Add-Border \"Background\" -ansitext \"$esc[46m\"\n    $n = 40..47\n    $n+= 100..107\n    $all = $n | ForEach-Object {\n         $sequence = \"$esctext[$($_)mHello$esctext[0m\"\n        \"$esc[1;$($_)m$sequence$esc[0m\"\n    }\n\n    display -all $all -Max $max\n\n    Write-Host \"`n\"\n    Add-Border \"8-Bit Background\" -ansitext \"$esc[7;38;5;10m\"\n    $all = 1..255 | ForEach-Object {\n         $sequence = \"$esctext[48;5;$($_)mHello$esctext[0m\"\n        \"$esc[1;48;5;$($_)m$sequence$esc[0m\"\n    }\n    display -all $all -Max $max\n}\n\nif ($RGB) {\n\n    if ($rgb.count -ne 3) {\n        Write-Warning \"Wrong number of arguments. Specify RED,GREEN and BLUE values\"\n        return\n    }\n    $test = $rgb | Where-object {$_ -gt 255}\n    if ($test.count -gt 0) {\n        Write-Warning \"Detected a value above 255\"\n        return $rgb\n    }\n\n    $r = $rgb[0]\n    $g = $rgb[1]\n    $b = $rgb[2]\n\n    $sequence = \"$esctext[38;2;$r;$g;$($b)m256 Color (R:$r)(G:$g)(B:$b)$esctext[0m\"\n    \"$esc[38;2;$r;$g;$($b)m$sequence$esc[0m\"\n\n}<\/code><\/pre>\n\n\n\n<p>As I said, this is a \"quick and dirty\" solution. The intention was that you could run it in a Windows PowerShell or PowerShell 7 session and see exactly what a sequence looks like on your system. The output will include the exact sequence you would use depending on your PowerShell version.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"412\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg\" alt=\"ansi-basic\" class=\"wp-image-7503\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg 708w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic-300x175.jpg 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p>You can test out basic settings. Not every setting will work on every system. For me, it looks like I could use Reverse, Underline and Bold.<\/p>\n\n\n\n<p>You can see Foreground options.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"683\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-fg.jpg\" alt=\"ansi-fg\" class=\"wp-image-7504\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-fg.jpg 910w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-fg-300x225.jpg 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-fg-768x576.jpg 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-fg-850x638.jpg 850w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/figure>\n\n\n\n<p>Background options:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"560\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-bg.jpg\" alt=\"ansi-bg\" class=\"wp-image-7505\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-bg.jpg 924w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-bg-300x182.jpg 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-bg-768x465.jpg 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-bg-850x515.jpg 850w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/figure>\n\n\n\n<p>I thought about displaying every RGB combination but realized that would quickly get out of hand. Instead you can specify an array of values in the order of R,G,B.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7506\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb.jpg\" alt=\"ansi-rgb\" width=\"848\" height=\"242\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb.jpg 848w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb-300x86.jpg 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb-768x219.jpg 768w\" sizes=\"auto, (max-width: 848px) 100vw, 848px\" \/>As you can see, or actually can't, some sequences work better than others depending on your session. Which is one of the reasons I wrote this.<\/p>\n\n\n\n<p>I hope you find it useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week I did a live session for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions.&nbsp; One of things I talked about was using ANSI escape sequences&nbsp; to add some color.&nbsp; What I realized was that I was constantly referring to my reference source at https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code.&nbsp; That&#8217;s&#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: A #PowerShell script to show sample ANSI output","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":[628,534,629,540],"class_list":["post-7502","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-ansi","tag-powershell","tag-pspowerhour","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Show ANSI Samples &#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\/7502\/show-ansi-samples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Show ANSI Samples &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Earlier this week I did a live session for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions.&nbsp; One of things I talked about was using ANSI escape sequences&nbsp; to add some color.&nbsp; What I realized was that I was constantly referring to my reference source at https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code.&nbsp; That&#039;s...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-29T16:44:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-01T15:55:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg\" \/>\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\\\/7502\\\/show-ansi-samples\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Show ANSI Samples\",\"datePublished\":\"2020-05-29T16:44:09+00:00\",\"dateModified\":\"2020-10-01T15:55:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/\"},\"wordCount\":285,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi-basic.jpg\",\"keywords\":[\"ANSI\",\"PowerShell\",\"PSPowerHour\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/\",\"name\":\"Show ANSI Samples &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi-basic.jpg\",\"datePublished\":\"2020-05-29T16:44:09+00:00\",\"dateModified\":\"2020-10-01T15:55:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi-basic.jpg\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi-basic.jpg\",\"width\":708,\"height\":412},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7502\\\/show-ansi-samples\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Show ANSI Samples\"}]},{\"@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":"Show ANSI Samples &#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\/7502\/show-ansi-samples\/","og_locale":"en_US","og_type":"article","og_title":"Show ANSI Samples &#8226; The Lonely Administrator","og_description":"Earlier this week I did a live session for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions.&nbsp; One of things I talked about was using ANSI escape sequences&nbsp; to add some color.&nbsp; What I realized was that I was constantly referring to my reference source at https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code.&nbsp; That's...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-05-29T16:44:09+00:00","article_modified_time":"2020-10-01T15:55:29+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg","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\/7502\/show-ansi-samples\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Show ANSI Samples","datePublished":"2020-05-29T16:44:09+00:00","dateModified":"2020-10-01T15:55:29+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/"},"wordCount":285,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg","keywords":["ANSI","PowerShell","PSPowerHour","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/","name":"Show ANSI Samples &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg","datePublished":"2020-05-29T16:44:09+00:00","dateModified":"2020-10-01T15:55:29+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-basic.jpg","width":708,"height":412},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Show ANSI Samples"}]},{"@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":7479,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/","url_meta":{"origin":7502,"position":0},"title":"Friday Fun with PowerShell and ANSI","author":"Jeffery Hicks","date":"May 15, 2020","format":false,"excerpt":"Ever since PowerShell 7 came along, I've been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run Get-PSReadlineOption to see what I'm talking about.\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\/ansibar-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":8853,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","url_meta":{"origin":7502,"position":1},"title":"Friday Fun &#8211; Painting a Pretty Picture with PowerShell","author":"Jeffery Hicks","date":"February 11, 2022","format":false,"excerpt":"A few months ago, I wrote about my PSClock module. This is a set of PowerShell commands for creating a digital clock using a transparent WPF form. You can install the module from the PowerShell Gallery. The repository can be found at https:\/\/github.com\/jdhitsolutions\/PSClock. Because my Windows wallpaper changes throughout the\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\/2022\/02\/format-table-colors.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7753,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7753\/powershell-color-combos\/","url_meta":{"origin":7502,"position":2},"title":"PowerShell Color Combos","author":"Jeffery Hicks","date":"October 1, 2020","format":false,"excerpt":"A lot of my PowerShell work lately has involved color. I find myself using ANSI escape sequences quite often. I'm also playing with different color schemes in Windows Terminal. And I still on occasion find myself using Write-Host to display colorized messages. What has gotten trickier is that Windows Terminal\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\/10\/console-colors.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":8041,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8041\/get-group-policy-links-with-powershell\/","url_meta":{"origin":7502,"position":3},"title":"Get Group Policy Links with PowerShell","author":"Jeffery Hicks","date":"January 18, 2021","format":false,"excerpt":"I was chatting with my friend Gladys Kravitz about Group Policy reporting stuff recently,. and the discussion led me to dust off some old code I had for getting Group Policy links using PowerShell. The GroupPolicy module has a Set-GPLink command, but nothing that easily shows you what GPOs are\u2026","rel":"","context":"In &quot;Active Directory&quot;","block_context":{"text":"Active Directory","link":"https:\/\/jdhitsolutions.com\/blog\/category\/active-directory\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":8163,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8163\/friday-fun-powershell-weather-widget\/","url_meta":{"origin":7502,"position":4},"title":"Friday Fun: PowerShell Weather Widget","author":"Jeffery Hicks","date":"February 12, 2021","format":false,"excerpt":"Recently, someone on Twitter turned me on to an resource that could be used in a PowerShell session to display weather information. This is apparently a well-established and well-regarded source. Once I worked out the basics, I naturally wanted to see what else I could do it with. Here's what\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\/weather-samples.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/02\/weather-samples.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/02\/weather-samples.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/02\/weather-samples.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/02\/weather-samples.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/449\/drive-report-console-chart\/","url_meta":{"origin":7502,"position":5},"title":"Drive Report Console Chart","author":"Jeffery Hicks","date":"October 15, 2009","format":false,"excerpt":"In thinking about some of my recent posts, I realize I should make clear that these scripts and functions are not necessarily good PowerShell examples. They don\u2019t take advantage of objects and the pipeline. They are single purpose and one-dimensional. Not that there\u2019s anything wrong with that. My recent examples,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"drivereport screenshot","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/10\/drivereport_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7502","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=7502"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7502\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}