{"id":1995,"date":"2012-01-12T09:43:45","date_gmt":"2012-01-12T14:43:45","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1995"},"modified":"2012-01-12T09:43:45","modified_gmt":"2012-01-12T14:43:45","slug":"convert-text-to-object-updated","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/","title":{"rendered":"Convert Text to Object Updated"},"content":{"rendered":"<p>I've had a few comments and emails lately about my post and script on <a href=\"http:\/\/jdhitsolutions.com\/blog\/2011\/10\/convert-text-to-object\/\" target=\"_blank\">converting text to objects<\/a>. I decided the function needed a little more lovin' so today I have an updated version, complete with comment based help.<\/p>\n<p><code lang='PowerShell'><br \/>\nFunction Convert-TextToObject {<\/p>\n<p><#\n.Synopsis\nConvert text to a PowerShell object\n.Description\nThis function takes a collection of simple delimited lines and\nturns them into an object. The function assumes a single delimiter.\nThe default delimiter is the colon (:). The item to the left will be \nthe property and the item on the left will be the property value.\n\nBy default the function will split on every delimiter, but you can use\nthe -SplitCount parameter to control the number of strings. If you don't \nwant to split at all use a value of 1. To split on the first delimiter \nonly, use a value of 2.\n\nFor example, if the string is: Foobar:  01\/11\/2012 09:41:28 and you tried\nto split on the \":\",  you would end up with 4 elements in the array. But \nusing a -SplitCount value of 2 would give you this:\n\nFoobar\n01\/11\/2012 09:41:28\n\nUse $GroupCount to keep track of items that come in groups and write a new \nobject when the count has been reached. For example, this allows you to \npipe in a long collection of strings and turn every 5 into an object.\n\nThis function works best with command line tools that write list-like\noutput.\n\n.Parameter Text\nThe text to be converted\n.Parameter Delimiter\nThe text delimiter to split on. The colon (\":\") is the default.\n.Parameter SplitCount\nThe number of strings to create when splitting. The default is to split\non all delimiters. If you don't want to split at all use a value of 1. \nTo split on the first delimiter only, use a value of 2.\n.Parameter GroupCount\nThe number of piped in strings to group together to form a new object.\n.Example\nPS C:> tasklist \/s server01 \/fo list | where {$_} | convert-texttoobject -group 5<\/p>\n<p>Take the output for Tasklist.exe as a list, strip out blank lines and pipe<br \/>\nto Convert-TextToObject. Turn every 5 items into an object.<br \/>\n.Example<br \/>\nPS C:\\> get-content c:\\work\\data.txt | select -skip 4 | where {$_} | cto -group 4 -SplitCount 2 | format-list<\/p>\n<p>LinkDate    : 11\/20\/2010 5:44:56 AM<br \/>\nDisplayName : 1394 OHCI Compliant Host Controller<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : 1394ohci<\/p>\n<p>LinkDate    : 11\/20\/2010 4:19:16 AM<br \/>\nDisplayName : Microsoft ACPI Driver<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : ACPI<\/p>\n<p>LinkDate    : 11\/20\/2010 4:30:42 AM<br \/>\nDisplayName : ACPI Power Meter Driver<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : AcpiPmi<\/p>\n<p>Get the Data.txt file, skipping the first 4 lines and stripping out blanks.<br \/>\nThen create objects for every 4 lines. The SplitCount is set to 2 so that<br \/>\nthe LinkDate value is the complete datetime stamp.<br \/>\n.Example<br \/>\nPS C:\\> whoami \/user \/fo list | where {$_ -match \":\"} | convert-texttoobject | format-table -auto<\/p>\n<p>UserName      SID<br \/>\n--------      ---<br \/>\nserenity\\jeff S-1-5-21-2858895768-3673612314-3109562570-1000<br \/>\n.Example<br \/>\nPS C:\\> whoami \/groups \/fo list | where {$_ -match \":\"} | cto -group 4 | format-list<\/p>\n<p>Attributes : Mandatory group, Enabled by default, Enabled group<br \/>\nType       : Well-known group<br \/>\nGroupName  : Everyone<br \/>\nSID        : S-1-1-0<\/p>\n<p>Attributes : Mandatory group, Enabled by default, Enabled group, Group owner<br \/>\nType       : Alias<br \/>\nGroupName  : BUILTIN\\Administrators<br \/>\nSID        : S-1-5-32-544<\/p>\n<p>...<\/p>\n<p>Get group listing from Whoami.exe and filter out lines that don't have a colon.<br \/>\nCreate objects for every 4 lines. This example is using the cto alias for the<br \/>\nConvert-TexttoObject function.<br \/>\n.Link<br \/>\nabout_Split<br \/>\nNew-Object<\/p>\n<p>.Inputs<br \/>\nStrings<\/p>\n<p>.Outputs<br \/>\nCustom object<br \/>\n#><\/p>\n<p>[cmdletbinding(SupportsShouldProcess=$True)]<\/p>\n<p>param (<br \/>\n[Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter a string to be parsed into an object\",<br \/>\nValueFromPipeline=$True)]<br \/>\n[ValidateNotNullorEmpty()]<br \/>\n[string[]]$Text,<br \/>\n[Parameter(Position=1)]<br \/>\n[ValidateNotNullOrEmpty()]<br \/>\n[string]$Delimiter=\":\",<br \/>\n[ValidateScript({$_ -ge 0})]<br \/>\n[int]$SplitCount=0,<br \/>\n[int]$GroupCount<br \/>\n)<\/p>\n<p>Begin {<br \/>\n    Write-Verbose \"Starting $($myinvocation.mycommand)\"<br \/>\n    #define a hashtable<br \/>\n    $myHash=@{}<br \/>\n    if ($GroupCount) {<br \/>\n        Write-Verbose \"Grouping every $GroupCount items as an object\"<br \/>\n    }<br \/>\n    #start an internal counter<br \/>\n    $i=0<br \/>\n    Write-Verbose \"Skipping $Skip lines\"<br \/>\n    Write-Verbose \"Using $Delimiter delimiter\"<br \/>\n    Write-Verbose \"Splitting into $SplitCount lines. 0 means all.\"<br \/>\n}<\/p>\n<p>Process {<br \/>\n    Foreach ($item in $text) {<br \/>\n      if ($i -lt $GroupCount) {<br \/>\n            $i++<br \/>\n         }<br \/>\n         else {<br \/>\n            #reset<br \/>\n            $i=1<br \/>\n         }<\/p>\n<p>         #split each line at the delimiter<br \/>\n         $data=$item -Split $delimiter,$SplitCount<br \/>\n         #remove spaces from \"property\" name<br \/>\n         $prop=$data[0].Replace(\" \",\"\")<\/p>\n<p>         #trim<br \/>\n         $prop=$prop.Trim()<br \/>\n         $val=$data[1].Trim()<\/p>\n<p>         #add to hash table<br \/>\n         Write-Verbose \"Adding $prop to hash table with a value of $val\"<br \/>\n         $myHash.Add($prop,$val)<\/p>\n<p>         #if internal counter is equal to the group count<br \/>\n         #write the object and reset the hash table<br \/>\n         if ($i -eq $groupCount) {<br \/>\n            New-Object -TypeName PSObject -Property $myHash<br \/>\n            $myHash.Clear()<br \/>\n         }<br \/>\n    } #foreach<br \/>\n}<br \/>\nEnd {<br \/>\n    #create new object from hash table<br \/>\n    if ($myHash.count -gt 0) {<br \/>\n        New-Object -TypeName PSObject -Property $myHash<br \/>\n        Write-Verbose \"Ending $($myinvocation.mycommand)\"<br \/>\n    }<br \/>\n}<\/p>\n<p>} #end function<br \/>\n<\/code><\/p>\n<p>Check out the original article to understand the basics. The major change here is the SplitCount parameter. Often you might end up with a line of text like this:<\/p>\n<p>LinkDate    : 11\/20\/2010 4:30:42 AM<\/p>\n<p>The function needs to split the string into an array on the colon. But when you do that, the time stamp will \"break\". The answer is to tell the Split operator how many strings to create. The default of 0 will split into all strings. <\/p>\n<p><code><br \/>\nPS C:\\> \"DisplayName : ACPI Power Meter Driver\" -split \":\",0<br \/>\nDisplayName<br \/>\n ACPI Power Meter Driver<br \/>\n<\/code><\/p>\n<p>If I try that with the time stamp string you see the problem.<\/p>\n<p><code><br \/>\nPS C:\\> \"LinkDate    : 11\/20\/2010 4:30:42 AM\" -split \":\",0<br \/>\nLinkDate<br \/>\n 11\/20\/2010 4<br \/>\n30<br \/>\n42 AM<br \/>\n<\/code><\/p>\n<p>But now I can specify the number of strings and I get what I need.<\/p>\n<p><code><br \/>\nPS C:\\> \"LinkDate    : 11\/20\/2010 4:30:42 AM\" -split \":\",2<br \/>\nLinkDate<br \/>\n 11\/20\/2010 4:30:42 AM<br \/>\n<\/code><\/p>\n<p>The new version of the function incorporates this. I also received a comment about including a skip feature. I kicked that idea around for awhile, but decided in the end that PowerShell already had a mechanism for skipping lines. I wanted to keep my function limited to a single purpose. So if your text output includes a number of lines you want to skip, before you begin converting text to object, use something like this:<\/p>\n<p><code><br \/>\nPS C:\\> get-content c:\\work\\data.txt | select -skip 4 | where {$_} | cto -group 4 -SplitCount 2 | format-list<\/p>\n<p>LinkDate    : 11\/20\/2010 5:44:56 AM<br \/>\nDisplayName : 1394 OHCI Compliant Host Controller<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : 1394ohci<\/p>\n<p>LinkDate    : 11\/20\/2010 4:19:16 AM<br \/>\nDisplayName : Microsoft ACPI Driver<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : ACPI<\/p>\n<p>LinkDate    : 11\/20\/2010 4:30:42 AM<br \/>\nDisplayName : ACPI Power Meter Driver<br \/>\nDriverType  : Kernel<br \/>\nModuleName  : AcpiPmi<br \/>\n<\/code><\/p>\n<p>The script file with the function, will also create an alias of cto. I hope you'll download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/01\/Convert-TexttoObject.-v1.5.txt' target='_blank'>Convert-TexttoObject.-v1.5<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve had a few comments and emails lately about my post and script on converting text to objects. I decided the function needed a little more lovin&#8217; so today I have an updated version, complete with comment based help. Function Convert-TextToObject { tasklist \/s server01 \/fo list | where {$_} | convert-texttoobject -group 5 Take&#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,8],"tags":[354,534,540,353],"class_list":["post-1995","post","type-post","status-publish","format-standard","hentry","category-commandline","category-powershell","category-powershell-v2-0","category-scripting","tag-convert","tag-powershell","tag-scripting","tag-split"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Convert Text to Object Updated &#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\/1995\/convert-text-to-object-updated\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert Text to Object Updated &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve had a few comments and emails lately about my post and script on converting text to objects. I decided the function needed a little more lovin&#039; so today I have an updated version, complete with comment based help. Function Convert-TextToObject { tasklist \/s server01 \/fo list | where {$_} | convert-texttoobject -group 5 Take...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2012-01-12T14:43:45+00:00\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"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\\\/1995\\\/convert-text-to-object-updated\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Convert Text to Object Updated\",\"datePublished\":\"2012-01-12T14:43:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/\"},\"wordCount\":250,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"Convert\",\"PowerShell\",\"Scripting\",\"Split\"],\"articleSection\":[\"CommandLine\",\"PowerShell\",\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/\",\"name\":\"Convert Text to Object Updated &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2012-01-12T14:43:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1995\\\/convert-text-to-object-updated\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CommandLine\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/commandline\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert Text to Object Updated\"}]},{\"@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":"Convert Text to Object Updated &#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\/1995\/convert-text-to-object-updated\/","og_locale":"en_US","og_type":"article","og_title":"Convert Text to Object Updated &#8226; The Lonely Administrator","og_description":"I've had a few comments and emails lately about my post and script on converting text to objects. I decided the function needed a little more lovin' so today I have an updated version, complete with comment based help. Function Convert-TextToObject { tasklist \/s server01 \/fo list | where {$_} | convert-texttoobject -group 5 Take...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/","og_site_name":"The Lonely Administrator","article_published_time":"2012-01-12T14:43:45+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Convert Text to Object Updated","datePublished":"2012-01-12T14:43:45+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/"},"wordCount":250,"commentCount":6,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["Convert","PowerShell","Scripting","Split"],"articleSection":["CommandLine","PowerShell","PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/","name":"Convert Text to Object Updated &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2012-01-12T14:43:45+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1995\/convert-text-to-object-updated\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"CommandLine","item":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},{"@type":"ListItem","position":2,"name":"Convert Text to Object Updated"}]},{"@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":1330,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/1330\/powershell-ise-convert-all-aliases\/","url_meta":{"origin":1995,"position":0},"title":"PowerShell ISE Convert All Aliases","author":"Jeffery Hicks","date":"April 8, 2011","format":false,"excerpt":"Yesterday I posted an article on how to convert a selected word to an alias or cmdlet. While I think there is still some value in this piecemeal approach. sometimes you want to make wholesale changes, such as when troubleshooting a script that someone else wrote that is full of\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1340,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1340\/convert-aliases-with-the-tokenizer\/","url_meta":{"origin":1995,"position":1},"title":"Convert Aliases with the Tokenizer","author":"Jeffery Hicks","date":"April 12, 2011","format":false,"excerpt":"Last week I posted a function you can use in the Windows PowerShell ISE to convert aliases to command definitions. My script relied on regular expressions to seek out and replace aliases. A number of people asked me why I didn't use the PowerShell tokenizer. My answer was that because\u2026","rel":"","context":"In &quot;PowerShell ISE&quot;","block_context":{"text":"PowerShell ISE","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-ise\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4985,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4985\/converting-text-to-html-revised\/","url_meta":{"origin":1995,"position":2},"title":"Converting Text to HTML Revised","author":"Jeffery Hicks","date":"May 9, 2016","format":false,"excerpt":"A few years ago I published a PowerShell function to convert text files into HTML listings. I thought it would be handy to convert scripts to HTML documents with line numbering and some formatting. Turns out someone actually used it! He had some questions about the function which led me\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"convertto-htmllisting2","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=525%2C300 1.5x"},"classes":[]},{"id":9018,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9018\/an-iron-scripter-warm-up-solution\/","url_meta":{"origin":1995,"position":3},"title":"An Iron Scripter Warm-Up Solution","author":"Jeffery Hicks","date":"May 6, 2022","format":false,"excerpt":"We just wrapped up the 2022 edition of the PowerShell+DevOps Global Summit. It was terrific to be with passionate PowerShell professionals again. The culmination of the event is the Iron Scripter Challenge. You can learn more about this year's event and winner here. But there is more to the Iron\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":8666,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/8666\/friday-fun-powershell-console-editing\/","url_meta":{"origin":1995,"position":4},"title":"Friday Fun: PowerShell Console Editing","author":"Jeffery Hicks","date":"October 29, 2021","format":false,"excerpt":"The other day I read an interesting article on Adam Bertram's blog about editing files with a text editor in PowerShell. Naturally, the PowerShell wheels in my head began turning. While I was intrigued by some of the options in the article, I've in fact installed the Micro editor to\u2026","rel":"","context":"In &quot;Scripting&quot;","block_context":{"text":"Scripting","link":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/nano-verbose.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/nano-verbose.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/nano-verbose.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/nano-verbose.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1040,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1040\/convert-to-title-case\/","url_meta":{"origin":1995,"position":5},"title":"Convert to Title Case","author":"Jeffery Hicks","date":"January 10, 2011","format":false,"excerpt":"After a long holiday break, some travel and a few training classes its time to get back in the swing of things. Today I have a relatively simple function, that if nothing else demonstrates how to use object methods. The challenge is to take a string of text and convert\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\/1995","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=1995"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1995\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}