{"id":840,"date":"2010-08-19T09:27:46","date_gmt":"2010-08-19T13:27:46","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=840"},"modified":"2010-08-19T09:27:46","modified_gmt":"2010-08-19T13:27:46","slug":"pipelines-consoles-and-hosts","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","title":{"rendered":"Pipelines, Consoles and Hosts"},"content":{"rendered":"<p>I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I've written about this before and I'm sure I'll cover it again, but when writing anything in PowerShell that you see in the PowerShell console, you have two choices. You can write directly to the host or to the pipeline.<\/p>\n<p>The host is the application that is hosting or running the underlying PowerShell plumbing. For many people, this will be the PowerShell.exe which results in the familiar large blue console you've come to know and love (I hope). Without going too far, suffice it to say that other applications can also host or run the PowerShell bits, each with perhaps a slightly different implementation than what most of us think of as the traditional (ie blue) console.  <\/p>\n<p>The pipeline is that special piece of PowerShell plumbing that objects travel. Cmdlets, functions and scriptblocks can work with objects in this pipeline.  When you execute a cmdlet, by design it writes objects to the pipeline. If you have a function you've created, it too can write functions to the pipeline. Generally all you have to do is run what ever PowerShell commands you wish in your function and objects will come out.  Or if you need something custom, you can use the New-Object cmdlet and create your own. The cmdlet for explicitly writing to the pipeline is Write-Output, which has an alias of Write.<\/p>\n<p>However, you can also use a cmdlet called Write-Host. The result is displayed in the console and it's impossible to tell whether it is an object or not.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png\" alt=\"\" title=\"write-demo\" width=\"501\" height=\"311\" class=\"aligncenter size-full wp-image-851\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png 501w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-300x186.png 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/a><\/p>\n<p>They look the same. This is what confuses people. But if you look at the results more closely you'll see a difference. Piping the first command generates an exception because nothing was written to the pipeline.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-noobject.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-noobject.png\" alt=\"\" title=\"write-demo-noobject\" width=\"613\" height=\"297\" class=\"aligncenter size-full wp-image-854\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-noobject.png 613w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-noobject-300x145.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/a><br \/>\nHowever the second example will produce an object. I'll let you try that out on your own.<\/p>\n<p>How can you fix this? Whenever I use Write-Host, which is great for communicating a message to the person running your code, I use the -Foregroundcolor parameter and change the font color. This makes it stand out and understand that anything colorized is not going to the pipeline. Let's look at this one more way.<\/p>\n<p>I have a demo function that can accept pipelined input.<br \/>\n[cc lang=\"powershell\"]<br \/>\nFunction Set-Foo {<br \/>\n    Param(<br \/>\n    [Parameter(Position=0,Mandatory=$False,<br \/>\n    ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]<br \/>\n    [Alias(\"name\",\"user\")]<br \/>\n    [string]$username=\"You\",<br \/>\n    [Parameter(Position=1,Mandatory=$False,<br \/>\n    ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]<br \/>\n    [ValidateScript({$_ -gt 0})]<br \/>\n    [int32]$radius<br \/>\n    )<\/p>\n<p>    Process {<br \/>\n        $pi=[Math]::PI<br \/>\n        $area=$pi * ($radius*$radius)<\/p>\n<p>        New-Object -TypeName PSObject -Property @{<br \/>\n            Radius=$radius<br \/>\n            Area=$area<br \/>\n            Calculated=Get-Date<br \/>\n            User=$username<br \/>\n        }<\/p>\n<p>    } #process<\/p>\n<p>} #end function<br \/>\n[\/cc]<\/p>\n<p>I also have another function that is intended to generate the inputs for Set-Foo. But I'm not getting the results I expect.<br \/>\n[cc lang=\"Powershell\"]<br \/>\nFunction Get-Foo {<\/p>\n<p>echo \"Working...please wait\"<br \/>\necho \"Jeff\"<br \/>\n$i=Get-Random -Minimum 1 -Maximum 10<br \/>\necho $i<\/p>\n<p>} #end function<br \/>\n[\/cc]<br \/>\nFor people coming from the CMD shell or VBScript they see the echo keyword and think this is just what they need. Echo is an alias for Write-Output. In Get-Foo, I want to also display a message to the user about what the function is doing. But look what happens when I pipe Get-Foo to Set-Foo.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-1-300x68.png\" alt=\"\" title=\"write-demo-1\" width=\"300\" height=\"68\" class=\"aligncenter size-medium wp-image-845\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-1-300x68.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-1.png 997w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nMy status message is being accepted as input which is not what I want. Let me tweak Get-Foo.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nFunction Get-Foo {<\/p>\n<p>write-host \"Working...please wait\" -ForegroundColor Green<br \/>\necho \"Jeff\"<br \/>\n$i=Get-Random -Minimum 1 -Maximum 10<br \/>\necho $i<\/p>\n<p>} #end function<br \/>\n[\/cc]<br \/>\nNow I'll re-run the command.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-2-300x62.png\" alt=\"\" title=\"write-demo-2\" width=\"300\" height=\"62\" class=\"aligncenter size-medium wp-image-846\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-2-300x62.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-2-940x198.png 940w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-2.png 997w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nBetter. At least now my status message isn't getting commingled with the pipelined output and messing up Set-Foo's input, which was my primary goal. But while I'm at it, I might as well fix Get-Foo so that it writes something to the pipeline that Set-Foo can actually use.<br \/>\n[cc lang=Powershell]<br \/>\nFunction Get-Foo {<\/p>\n<p>    write-host \"Working...please wait\" -ForegroundColor Green<br \/>\n    $name=\"Jeff\"<br \/>\n    $i=Get-Random -Minimum 1 -Maximum 10<br \/>\n    New-Object -TypeName PSObject -Property @{<br \/>\n        Name=$name<br \/>\n        Radius=$i<br \/>\n    }<\/p>\n<p>} #end function<br \/>\n[\/cc]<br \/>\nI used the New-Object cmdlet to create a custom object with the property names Set-Foo is expecting. Now let's see what happens.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-3-300x68.png\" alt=\"\" title=\"write-demo-3\" width=\"300\" height=\"68\" class=\"aligncenter size-medium wp-image-848\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-3-300x68.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo-3.png 997w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nThat's much more along the lines of what I was expecting. <\/p>\n<p>If you follow these guidelines your PowerShell scripting experience will be much more productive and pleasant.<\/p>\n<li>Use Write-Host with a foreground color to display status messages. Or use Write-Progress.<\/li>\n<li>Use Write-Output to write objects to the pipeline. <\/li>\n<li>Always try to leverage the pipeline by accepting input objects and writing objects.<\/li>\n","protected":false},"excerpt":{"rendered":"<p>I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I&#8217;ve written about this before and I&#8217;m sure I&#8217;ll cover it again, but when writing anything in PowerShell that you see in the PowerShell console, you have&#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":[4,8],"tags":[144,534,540],"class_list":["post-840","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-objects","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>Pipelines, Consoles and Hosts &#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\/840\/pipelines-consoles-and-hosts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pipelines, Consoles and Hosts &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I&#039;ve written about this before and I&#039;m sure I&#039;ll cover it again, but when writing anything in PowerShell that you see in the PowerShell console, you have...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-08-19T13:27:46+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Pipelines, Consoles and Hosts\",\"datePublished\":\"2010-08-19T13:27:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/\"},\"wordCount\":775,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/write-demo.png\",\"keywords\":[\"objects\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/\",\"name\":\"Pipelines, Consoles and Hosts &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/write-demo.png\",\"datePublished\":\"2010-08-19T13:27:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#primaryimage\",\"url\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/write-demo.png\",\"contentUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/write-demo.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/840\\\/pipelines-consoles-and-hosts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pipelines, Consoles and Hosts\"}]},{\"@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":"Pipelines, Consoles and Hosts &#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\/840\/pipelines-consoles-and-hosts\/","og_locale":"en_US","og_type":"article","og_title":"Pipelines, Consoles and Hosts &#8226; The Lonely Administrator","og_description":"I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I've written about this before and I'm sure I'll cover it again, but when writing anything in PowerShell that you see in the PowerShell console, you have...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-08-19T13:27:46+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Pipelines, Consoles and Hosts","datePublished":"2010-08-19T13:27:46+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/"},"wordCount":775,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png","keywords":["objects","PowerShell","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","name":"Pipelines, Consoles and Hosts &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png","datePublished":"2010-08-19T13:27:46+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#primaryimage","url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png","contentUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/write-demo.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Pipelines, Consoles and Hosts"}]},{"@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":558,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/558\/promoting-scripting-and-powershell\/","url_meta":{"origin":840,"position":0},"title":"Promoting Scripting and PowerShell","author":"Jeffery Hicks","date":"January 21, 2010","format":false,"excerpt":"Last week I was interviewed on the Mind of Root podcast about what administrators can do to promote PowerShell and automation in their environments. The show is now available for streaming or download. I still think your best approach is to gently let everyone know that it's not a matter\u2026","rel":"","context":"In &quot;Exchange&quot;","block_context":{"text":"Exchange","link":"https:\/\/jdhitsolutions.com\/blog\/category\/exchange\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4723,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4723\/a-powershell-new-year\/","url_meta":{"origin":840,"position":1},"title":"A PowerShell New Year","author":"Jeffery Hicks","date":"December 31, 2015","format":false,"excerpt":"First off, let me thank all of you for your support and interest in my work this past year. Without it I'd be another old man sitting in his bathrobe talking to himself. I hope I can keep your interest in 2016. To wrap up the year and to bring\u2026","rel":"","context":"In &quot;Miscellaneous&quot;","block_context":{"text":"Miscellaneous","link":"https:\/\/jdhitsolutions.com\/blog\/category\/miscellaneous\/"},"img":{"alt_text":"Champagne_glasses","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/Champagne_glasses_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":9187,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9187\/friday-fun-powershell-scripting-with-chatgpt\/","url_meta":{"origin":840,"position":2},"title":"Friday Fun: PowerShell Scripting with ChatGPT","author":"Jeffery Hicks","date":"December 16, 2022","format":false,"excerpt":"I have been trying out the latest AI, ChatGPT. I've asked it silly questions. As well as the really important questions. But what I find most fascinating is using ChatGPT to write PowerShell code. I gave the AI this instruction: \"Write a PowerShell function that will display \"Hello, World\" in\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\/2022\/12\/woodchuck.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/12\/woodchuck.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/12\/woodchuck.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/12\/woodchuck.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/12\/woodchuck.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/12\/woodchuck.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":3912,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3912\/friday-fun-a-random-powershell-console\/","url_meta":{"origin":840,"position":3},"title":"Friday Fun: A Random PowerShell Console","author":"Jeffery Hicks","date":"July 11, 2014","format":false,"excerpt":"This week I thought we'd have a little fun with the PowerShell console and maybe pick up a few scripting techniques along the way. Today I have a function that changes the foreground and background colors of your PowerShell console to random values. But because you might want to go\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"crayons","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/crayons-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3455,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3455\/friday-fun-color-my-web\/","url_meta":{"origin":840,"position":4},"title":"Friday Fun Color My Web","author":"Jeffery Hicks","date":"September 20, 2013","format":false,"excerpt":"Awhile ago I posted an article demonstrating using Invoke-Webrequest which is part of PowerShell 3.0. I used the page at Manning.com to display the Print and MEAP bestsellers. By the way, thanks to all of you who keep making PowerShell books popular. My original script simply wrote the results to\u2026","rel":"","context":"In &quot;Books&quot;","block_context":{"text":"Books","link":"https:\/\/jdhitsolutions.com\/blog\/category\/books\/"},"img":{"alt_text":"get-manningbestseller1","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/09\/get-manningbestseller1-1024x606.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/09\/get-manningbestseller1-1024x606.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/09\/get-manningbestseller1-1024x606.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5806,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5806\/a-powershell-countdown-timer\/","url_meta":{"origin":840,"position":5},"title":"A PowerShell Countdown Timer","author":"Jeffery Hicks","date":"December 6, 2017","format":false,"excerpt":"The other day, during one of the monthly #PSTweetChat sessions, I exchanged some tweets with Joshua King. We got on the topic of countdown timers and he shared some code he uses for his YouTube channel. The command creates a progress bar and counts down, displaying some humorous messages along\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\/840","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=840"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/840\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}