{"id":2002,"date":"2012-01-13T08:50:58","date_gmt":"2012-01-13T13:50:58","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2002"},"modified":"2012-01-13T08:50:58","modified_gmt":"2012-01-13T13:50:58","slug":"friday-fun-output-to-2-places-in-1","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/","title":{"rendered":"Friday Fun: Output to 2 Places in 1"},"content":{"rendered":"<p>Today's Friday Fun comes out of a short exchange I had yesterday with <a href=\"https:\/\/plus.google.com\/106423422372421380780\/posts\" target=\"_blank\">Hal Rottenberg on Google Plus<\/a>. We were playing around with piping a PowerShell command to Clip.exe which dumps the output to the Windows Clipboard. I got to thinking about taking this a step further based on my needs as a writer. Often I'd like to see the results of a command and then copy and paste the results into whatever I'm working on. In other words, I need to TEE the output to two places.<\/p>\n<p>PowerShell has a cmdlet called Tee-Object that follows this principal. The default behavior is to write output to the pipeline AND send it to a text file.<\/p>\n<p><code><br \/>\nPS C:\\> get-service | tee c:\\work\\svc.txt<br \/>\n<\/code><\/p>\n<p>I'll see the results and save them to a text file. I can also use this cmdlet to save results to a variable.<\/p>\n<p><code><br \/>\nPS C:\\> get-service | tee c:\\work\\svc.txt<\/p>\n<p>Status   Name               DisplayName<br \/>\n------   ----               -----------<br \/>\nRunning  AeLookupSvc        Application Experience<br \/>\nStopped  ALG                Application Layer Gateway Service<br \/>\nStopped  AppIDSvc           Application Identity<br \/>\nStopped  Appinfo            Application Information<br \/>\n...<br \/>\nRunning  wudfsvc            Windows Driver Foundation - User-mo...<br \/>\nStopped  WwanSvc            WWAN AutoConfig<\/p>\n<p>PS C:\\> $svc.count<br \/>\n196<br \/>\nPS C:\\><br \/>\n<\/code><\/p>\n<p>One approach I came up with to incorporate with Clip.exe was this:<\/p>\n<p><code><br \/>\nPS C:\\> get-service | tee -Variable svc | clip<br \/>\n<\/code><\/p>\n<p>I don't get the results immediately to the screen; they are saved to the variable. But at the same time output has been directed to the Windows Clipboard. That could be useful. But you know me, I always have to tinker a bit more and I ended up with a function called Out-Tee.<\/p>\n<p><code lang='PowerShell'><br \/>\nFunction Out-Tee {<\/p>\n<p>[cmdletbinding()]<\/p>\n<p>Param (<br \/>\n[Parameter(Position=0,Mandatory=$True,ValueFromPipeline=$True)]<br \/>\n[object[]]$InputObject,<br \/>\n[alias(\"foregroundcolor\",\"fg\")]<br \/>\n[string]$TextColor=$host.ui.rawui.ForegroundColor<br \/>\n)<\/p>\n<p>Begin {<br \/>\n #define an empty array to hold piped in objects<br \/>\n $a=@()<br \/>\n}<\/p>\n<p>Process {<br \/>\n    #add each piped in object to the array<br \/>\n    $a+=$inputobject<br \/>\n}<\/p>\n<p>End {<br \/>\n    #write the array to the pipeline as a string then pass to Write-Host<br \/>\n    $a | out-string | write-host -fore $textColor<br \/>\n    #write the array again to Clip.exe<br \/>\n    $a | clip<br \/>\n}<\/p>\n<p>} #end function<br \/>\n<\/code><\/p>\n<p>This simple function takes a PowerShell expression and writes the results to the console using Write-Host and also to the clipboard.  The default output will use the current console foreground color. But you can specify any other color that you would use with Write-Host. I even added some alias properties so you can use -foregroundcolor or -fg.<\/p>\n<p>With this function I can see the result and have it dumped to the clipboard. Because the default text color is the same as my session, I don't see any difference when using Out-Tee.<\/p>\n<p><code><br \/>\nPS C:\\> ps | where {$_.ws -gt 100mb} | out-tee<br \/>\n<\/code><\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.png\" alt=\"\" title=\"out-tee-1\" width=\"300\" height=\"141\" class=\"aligncenter size-medium wp-image-2003\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-1024x483.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1.png 1157w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Or if I want to pretty it up, I can add a little color.<\/p>\n<p><code><br \/>\nPS C:\\> ps | where {$_.ws -gt 100mb} | out-tee -TextColor green<br \/>\n<\/code><\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-2-300x141.png\" alt=\"\" title=\"out-tee-2\" width=\"300\" height=\"141\" class=\"aligncenter size-medium wp-image-2004\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-2-300x141.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-2-1024x483.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-2.png 1157w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Of course, the clipboard is just text. But now I have something easier to use to save output to the clipboard so I can paste it into my documents, assuming I like the output I see on the screen. The one caveat is that this function only works with successful commands. Errors, warnings, or verbose statements won't get dumped to the clipboard. I can think of some ways around that which I might try in a future version. But for my immediate needs this works just fine.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/Out-Tee.txt' target='_blank'>Out-Tee<\/a> and give it a try.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s Friday Fun comes out of a short exchange I had yesterday with Hal Rottenberg on Google Plus. We were playing around with piping a PowerShell command to Clip.exe which dumps the output to the Windows Clipboard. I got to thinking about taking this a step further based on my needs as a writer. Often&#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,75],"tags":[230,224,534,355,101],"class_list":["post-2002","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell-v2-0","tag-fridayfun","tag-function","tag-powershell","tag-tee-object","tag-write-host"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun: Output to 2 Places in 1 &#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-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: Output to 2 Places in 1 &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Today&#039;s Friday Fun comes out of a short exchange I had yesterday with Hal Rottenberg on Google Plus. We were playing around with piping a PowerShell command to Clip.exe which dumps the output to the Windows Clipboard. I got to thinking about taking this a step further based on my needs as a writer. Often...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2012-01-13T13:50:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.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-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: Output to 2 Places in 1\",\"datePublished\":\"2012-01-13T13:50:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/\"},\"wordCount\":417,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/out-tee-1-300x141.png\",\"keywords\":[\"FridayFun\",\"Function\",\"PowerShell\",\"Tee-Object\",\"Write-Host\"],\"articleSection\":[\"Friday Fun\",\"PowerShell v2.0\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/\",\"name\":\"Friday Fun: Output to 2 Places in 1 &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/out-tee-1-300x141.png\",\"datePublished\":\"2012-01-13T13:50:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/out-tee-1.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/out-tee-1.png\",\"width\":\"1157\",\"height\":\"546\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-v2-0\\\/2002\\\/friday-fun-output-to-2-places-in-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: Output to 2 Places in 1\"}]},{\"@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: Output to 2 Places in 1 &#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-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: Output to 2 Places in 1 &#8226; The Lonely Administrator","og_description":"Today's Friday Fun comes out of a short exchange I had yesterday with Hal Rottenberg on Google Plus. We were playing around with piping a PowerShell command to Clip.exe which dumps the output to the Windows Clipboard. I got to thinking about taking this a step further based on my needs as a writer. Often...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/","og_site_name":"The Lonely Administrator","article_published_time":"2012-01-13T13:50:58+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.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-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: Output to 2 Places in 1","datePublished":"2012-01-13T13:50:58+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/"},"wordCount":417,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.png","keywords":["FridayFun","Function","PowerShell","Tee-Object","Write-Host"],"articleSection":["Friday Fun","PowerShell v2.0"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/","name":"Friday Fun: Output to 2 Places in 1 &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1-300x141.png","datePublished":"2012-01-13T13:50:58+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/out-tee-1.png","width":"1157","height":"546"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/2002\/friday-fun-output-to-2-places-in-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: Output to 2 Places in 1"}]},{"@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":4489,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4489\/teeing-up-to-the-clipboard\/","url_meta":{"origin":2002,"position":0},"title":"Teeing Up to the Clipboard","author":"Jeffery Hicks","date":"August 12, 2015","format":false,"excerpt":"Because I spend a great part of my day creating PowerShell related content, I often need to copy command output from a PowerShell session. The quick and dirty solution is to pipe my expression to the Clip.exe command line utility. get-service | where { $_.status -eq 'running'} | clip This\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":2144,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2144\/have-your-output-and-variable-too\/","url_meta":{"origin":2002,"position":1},"title":"Have Your Output and Variable Too","author":"Jeffery Hicks","date":"March 29, 2012","format":false,"excerpt":"There's a relatively useful suggestion floating around on Twitter on how to save results of PowerShell command to a variable and see the results at the same time. PS C:\\> ($data=get-process) I'll admit this is a clever technique: you get the results from Get-Process written to the pipeline AND a\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":4581,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4581\/powershell-friday-fun-capture-the-command\/","url_meta":{"origin":2002,"position":2},"title":"PowerShell Friday Fun: Capture the Command","author":"Jeffery Hicks","date":"October 30, 2015","format":false,"excerpt":"This week's Friday Fun actually has a purpose, at least for me. But I always hope you'll pick up a tip or two that you can use in your own PowerShell work. Because I write a lot about PowerShell, I am constantly copying pasting between my PowerShell session and usually\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":418,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/418\/out-notepad\/","url_meta":{"origin":2002,"position":3},"title":"Out-Notepad","author":"Jeffery Hicks","date":"October 6, 2009","format":false,"excerpt":"Maybe this isn\u2019t the most earth shattering PowerShell function you\u2019ll ever come across, but it saves me a few keystrokes. There are times when I want to see the results of PowerShell expression but the console output is insufficient. I want to see the results in a text file opened\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":37,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/37\/get-active-directory-user-information-in-powershell\/","url_meta":{"origin":2002,"position":4},"title":"Get Active Directory User Information in PowerShell","author":"Jeffery Hicks","date":"July 5, 2006","format":false,"excerpt":"One feature that PowerShell will likely be missing when it first ships is solid support for ADSI and working with Active Directory. You can use .NET DirectoryEntry objects but it feels more like programming and less like scripting. Another option for working with Active Directory in PowerShell is to use\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":4707,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4707\/a-better-powershell-more\/","url_meta":{"origin":2002,"position":5},"title":"A Better PowerShell More","author":"Jeffery Hicks","date":"December 23, 2015","format":false,"excerpt":"In PowerShell, when I have a lot of output, I can use the legacy more.com command to page the results to the screen. Get-Process | more There's not anything inherently wrong with this approach. Although one drawback is that it doesn't work in the PowerShell ISE. For that reason alone\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"More PowerShell Output","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2002","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=2002"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2002\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}