{"id":1757,"date":"2011-11-14T11:23:17","date_gmt":"2011-11-14T16:23:17","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1757"},"modified":"2011-11-14T11:23:17","modified_gmt":"2011-11-14T16:23:17","slug":"turning-ipconfig-dnscache-into-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/","title":{"rendered":"Turning IPConfig DNSCache into PowerShell"},"content":{"rendered":"<p>Lately I've been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today I have another example that takes the DNS cache from IPConfig and turns it into a collection of PowerShell objects.<!--more--><\/p>\n<p>To understand what I'm talking about open a prompt (Powershell or CMD) and run ipconfig \/displaydns. <\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.png\" alt=\"\" title=\"Ipconfig \/displaydns\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-1761\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns.png 932w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In text format there is essentially an \"object\" for each entry separated by the dashed line. What I needed to do was turn that into an PowerShell-based object. If you look at your output you'll see the challenging part is that there isn't necessarily a consistent output for each host. Some entries might not have any record types. When you have output like this I think you need to determine what is really important and is there anything in common you can work with? I decided all I really needed was the record name, its type and value (ie A or CNAME record value).  <\/p>\n<p>So my first pass at the output is to pipe it to Select-String.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$data=ipconfig \/displaydns | select-string \"Record \"<br \/>\n[\/cc]<\/p>\n<p>I'm filtering on the string record followed by a space. Barring some odd result, this should leave me with 3 lines of data for each DNS entry in the cache. Now the fun part.  I need to create a new object for every 3 lines of data. I accomplished this with a For construct.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nfor ($i=0;$i -lt $data.count;$i+=3) {<br \/>\n    Write-Verbose $data[$i]<br \/>\n...<br \/>\n[\/cc]<\/p>\n<p>The \"trick\" here is that instead of incrementing by 1 each time through the For loop which we typically do, I'm stepping by 3. Within the For loop I can parse each entry. <\/p>\n<p>When you use Select-String, the output is not a simple string but a Match object. I could have messed with the Matches property but I decided it was just as easy to turn each one into a string. Once I have a string, then I can split it on the colon and grab the \"value\".<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nNew-Object -TypeName PSobject -Property @{<br \/>\n      Name=$data[$i].toString().Split(\":\")[1].Trim()<br \/>\n      Type=($data[$i+1].toString().Split(\":\")[1].Trim()) -as [int]<br \/>\n      Value=$data[$i+2].toString().Split(\":\")[1].Trim()<br \/>\n  }<br \/>\n[\/cc]<\/p>\n<p>Each \"value\" is added as a property value for a custom object. I like trimming values because you'll often end up with leading and trailing spaces which can cause issues later. Notice also that I'm casing the Type as an [Int}. I did this so any sort on that property will be accurate.  <\/p>\n<p>Here's my full sample script.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#requires -version 2.0<\/p>\n<p>[cmdletbinding()]<br \/>\nParam()<\/p>\n<p>Write-Verbose \"Getting DNS cache information\"<br \/>\n#parse dns data looking only for \"Record\" followed by a space<br \/>\n$data=ipconfig \/displaydns | select-string \"Record \"<\/p>\n<p>Write-Verbose (\"Retrieved {0} entries\" -f $data.count)<br \/>\nWrite-Verbose (\"There should be {0} dns records\" -f ($data.count\/3))<\/p>\n<p>#should be grouped into 3s.<br \/>\nfor ($i=0;$i -lt $data.count;$i+=3) {<br \/>\n    Write-Verbose $data[$i]<\/p>\n<p>    #each item is a Match object so convert to string, split at colon,<br \/>\n    #grab the last item and trim it up. Cast the Type as an integer<br \/>\n    #so it sorts properly<\/p>\n<p>    New-Object -TypeName PSobject -Property @{<br \/>\n      Name=$data[$i].toString().Split(\":\")[1].Trim()<br \/>\n      Type=($data[$i+1].toString().Split(\":\")[1].Trim()) -as [int]<br \/>\n      Value=$data[$i+2].toString().Split(\":\")[1].Trim()<br \/>\n  }<br \/>\n} #for<\/p>\n<p>Write-Verbose \"Finished parsing DNS cache data\"<br \/>\n[\/cc]<\/p>\n<p>When I run the script I'll get an object like this for each entry in my DNS cache.<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nValue            Name         Type<br \/>\n-----            ----         ----<br \/>\n64.191.203.30    digg.com        1<br \/>\n[\/cc]<\/p>\n<p>Or I can enjoy all the benefits of the PowerShell pipeline:<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nPS S:\\> .\\get-ipconfigdns.ps1 | where {$_.type -eq 1} | sort Name | Select Name,Value<\/p>\n<p>Name                                    Value<br \/>\n----                                    -----<br \/>\napi.bitly.com                           69.58.188.41<br \/>\napi.bitly.com                           69.58.188.42<br \/>\napi-ssl.bitly.com                       69.58.188.38<br \/>\napi-ssl.bitly.com                       69.58.188.37<br \/>\nav3.lyncweb.microsoft.com               65.55.30.131<br \/>\nblog.sapien.com                         98.129.229.162<br \/>\nblogpulse.com                           208.64.96.141<br \/>\nclient1.jdhlab.local                    172.16.10.192<br \/>\n...<br \/>\n[\/cc]<\/p>\n<p>I don't expect you to use this script in a production environment, but maybe you'll find a technique or two that might help.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/Get-IpconfigDNS.txt' target='_blank'>Get-IpconfigDNS<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lately I&#8217;ve been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today&#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":[72,4,75],"tags":[56,336,144,534,540],"class_list":["post-1757","post","type-post","status-publish","format-standard","hentry","category-commandline","category-powershell","category-powershell-v2-0","tag-dns","tag-ipconfig","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>Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Lately I&#039;ve been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-14T16:23:17+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.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\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Turning IPConfig DNSCache into PowerShell\",\"datePublished\":\"2011-11-14T16:23:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/\"},\"wordCount\":710,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/displaydns-300x168.png\",\"keywords\":[\"DNS\",\"IPConfig\",\"objects\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"CommandLine\",\"PowerShell\",\"PowerShell v2.0\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/\",\"name\":\"Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/displaydns-300x168.png\",\"datePublished\":\"2011-11-14T16:23:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/displaydns.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/displaydns.png\",\"width\":\"932\",\"height\":\"525\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1757\\\/turning-ipconfig-dnscache-into-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CommandLine\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/commandline\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Turning IPConfig DNSCache into PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator","og_description":"Lately I've been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-11-14T16:23:17+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.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\/1757\/turning-ipconfig-dnscache-into-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Turning IPConfig DNSCache into PowerShell","datePublished":"2011-11-14T16:23:17+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/"},"wordCount":710,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.png","keywords":["DNS","IPConfig","objects","PowerShell","Scripting"],"articleSection":["CommandLine","PowerShell","PowerShell v2.0"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/","name":"Turning IPConfig DNSCache into PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns-300x168.png","datePublished":"2011-11-14T16:23:17+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/displaydns.png","width":"932","height":"525"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1757\/turning-ipconfig-dnscache-into-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"CommandLine","item":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},{"@type":"ListItem","position":2,"name":"Turning IPConfig DNSCache into PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3763,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3763\/more-fun-with-string-properties\/","url_meta":{"origin":1757,"position":0},"title":"More Fun with String Properties","author":"Jeffery Hicks","date":"March 27, 2014","format":false,"excerpt":"The other day I posted an article about converting string properties that you might get from running a command line tool into a PowerShell named property. I was continuing to experiment with it. Here's some code on how I could use it. $raw = qprocess $properties = $raw[0] -split \"\\s{2,}\"\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"convert-clioutput-1","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/03\/convert-clioutput-1-1024x633.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6855,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/6855\/powershell-scripting-for-linux-is-still-about-the-objects\/","url_meta":{"origin":1757,"position":1},"title":"PowerShell Scripting for Linux is Still About the Objects","author":"Jeffery Hicks","date":"October 8, 2019","format":false,"excerpt":"I've been trying to increase my Linux skills, especially as I begin to write PowerShell scripts and tools that can work cross-platform. One very important concept I want to make sure you don't overlook is that even when scripting for non-Windows platforms, you must still be thinking about objects. The\u2026","rel":"","context":"In &quot;PowerShell 7&quot;","block_context":{"text":"PowerShell 7","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-7\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1708,"url":"https:\/\/jdhitsolutions.com\/blog\/commandline\/1708\/turning-cli-tools-into-powershell-tools-deep-dive-demos\/","url_meta":{"origin":1757,"position":2},"title":"Turning CLI Tools into PowerShell Tools Deep Dive Demos","author":"Jeffery Hicks","date":"October 24, 2011","format":false,"excerpt":"Last week I did a presentation at the PowerShell Deep Dive in Frankfurt about turning command line tools into PowerShell tools. A video recording should be posted later. But in the meantime, here is a copy of my slide deck, in PDF and a zip file with my demos and\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/nbtstat-n-300x158.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8835,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8835\/powershell-7-consolegridview\/","url_meta":{"origin":1757,"position":3},"title":"PowerShell 7 ConsoleGridView","author":"Jeffery Hicks","date":"February 3, 2022","format":false,"excerpt":"Last night during my presentation for the Research Triangle PowerShell User Group, I briefly demonstrated a PowerShell 7 command called Out-ConsoleGridView. This command will not run in Windows PowerShell. If you haven't thought about running PowerShell 7, maybe you'll reconsider after learning more about this tool. You all know 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\/2022\/02\/eventlog-errors.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/eventlog-errors.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/eventlog-errors.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/eventlog-errors.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4707,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4707\/a-better-powershell-more\/","url_meta":{"origin":1757,"position":4},"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":[]},{"id":1716,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1716\/convert-text-to-object\/","url_meta":{"origin":1757,"position":5},"title":"Convert Text to Object","author":"Jeffery Hicks","date":"October 25, 2011","format":false,"excerpt":"Today I have another tool in my new battle regarding turning command line tools into PowerShell tools. The bottom line is we want to have objects written to the pipeline. At the PowerShell Deep Dive in Frankfurt there was a suggestion about providing tools to help with the transformation from\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1757","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=1757"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1757\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}