{"id":3727,"date":"2014-02-27T09:08:54","date_gmt":"2014-02-27T14:08:54","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3727"},"modified":"2014-02-27T09:08:54","modified_gmt":"2014-02-27T14:08:54","slug":"find-and-replace-text-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/","title":{"rendered":"Find and Replace Text with PowerShell"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png\" alt=\"magnifying-glass\" width=\"288\" height=\"288\" class=\"alignleft size-full wp-image-3539\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png 288w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass-150x150.png 150w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a> I've just finished up a series of tweets with a follower who had a question about finding and replacing a bit of data in a text file. In his case it was a web.config file but it really could be any text file that you can view in PowerShell. In PowerShell 3.0 and later this isn't too difficult. Although I haven't tested with really large files to determine if there are any limitations. Before you try anything I'm going to show you, please have a backup copy of of the original file.<\/p>\n<p>Let's say I have a file like this:<\/p>\n<pre class=\"lang:batch decode:true \" >&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;\r\n&lt;configuration&gt;\r\n    \r\n  &lt;configSections&gt;\r\n   &lt;section\r\n        name=\"ADVWRK\"\r\ntype=\"System.Configuration.NameValueSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null\" \/&gt;\r\n  &lt;\/configSections&gt;\r\n  &lt;ADVWRK&gt;\r\n     &lt;add key=\"ConnectionString\" value='data source=192.168.97.199;initial catalog=Adventure_Works_Cycle_MSCRM;password=\"\";persist security info=True;user id=sa;workstation id=CRMSERVER;packet size=4096' \/&gt;\r\n     &lt;add key=\"TraceMode\" value=\"0\" \/&gt;\r\n     &lt;add key=\"UserName\" value=\"\" \/&gt;\r\n     &lt;add key=\"Password\" value=\"\" \/&gt;\r\n     &lt;add key=\"Domain\" value=\"\" \/&gt;\r\n     &lt;add key=\"CRMServer\" value=\"CRM.Company.com\" \/&gt;\r\n  &lt;\/ADVWRK&gt;\r\n  &lt;system.web&gt;\r\n &lt;customErrors mode=\"Off\"\/&gt;\r\n&lt;compilation defaultLanguage=\"C#\" debug=\"false\"\/&gt;\r\n&lt;identity impersonate=\"true\"\/&gt;\r\n&lt;pages buffer=\"true\" enableSessionState=\"false\" enableViewState=\"true\"\/&gt;\r\n &lt;\/system.web&gt;\r\n&lt;\/configuration&gt;<\/pre>\n<p>I need to change the IP source address in the connection string. As you probably guessed Get-Content is going to come into play. Normally when you use Get-Content you get an array of strings which adds a little complexity. But starting in v3 Get-Content has a -Raw parameter which writes the entire file as a single string. If we have a single string then we can easily use -Replace.<\/p>\n<pre class=\"lang:ps decode:true \" >$find = \"192.168.97.199\"\r\n$replace = \"192.168.97.200\"\r\n$content = Get-Content $file -Raw\r\n#write replaced content back to the file\r\n$content -replace $find,$replace | Out-File $file <\/pre>\n<p>Your replacement pattern could even be a regular expression pattern. This could even be done as a one-liner:<\/p>\n<pre class=\"lang:ps decode:true \" >(get-content $file -raw) -replace $find,$replace | out-file $file<\/pre>\n<p>For many of you, especially with unstructured text files, this technique should get the job done. But in this case, because the text file is also an XML document we could tackle the problem a different way. This is especially useful if you have several changes you want to make to the file.  <\/p>\n<p>First, create an XML document from the file.<\/p>\n<pre class=\"lang:ps decode:true \" >[xml]$config = get-content $file<\/pre>\n<p>We can navigate the document until we find the entry we need to change.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlconfig.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlconfig-300x219.png\" alt=\"xmlconfig\" width=\"300\" height=\"219\" class=\"aligncenter size-medium wp-image-3728\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlconfig-300x219.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlconfig.png 911w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We can assign a new value with revised connection string:<\/p>\n<pre class=\"lang:ps decode:true \" >$newcs = 'data source=192.168.97.200;initial catalog=Adventure_Works_Cycle_MSCRM;password=\"\";persist security info=True;user id=sa;workstation id=CRMSERVER;packet size=2048'\r\n\r\n$config.configuration.ADVWRK.add[0].value = $newcs<\/pre>\n<p>All that remains is to save the file back to disk.<\/p>\n<pre class=\"lang:ps decode:true \" >#save the XML to file\r\n$config.Save($file)<\/pre>\n<p>Or, if you didn't necessarily know the structure of your document, you could use an XPath query with Select-XML to find the node and then change the value.<\/p>\n<pre class=\"lang:ps decode:true \" >$cs =  $config | Select-Xml -XPath '\/\/*[@key=\"ConnectionString\"]'\r\n\r\n#assign the value\r\n$cs.node.value = $newcs\r\n\r\n#save the XML to file\r\n$config.Save($file)\r\n<\/pre>\n<p>The node properties will vary depending on your XML file so you will need to look at the object.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlnode.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlnode-300x181.png\" alt=\"xmlnode\" width=\"300\" height=\"181\" class=\"aligncenter size-medium wp-image-3730\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlnode-300x181.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/xmlnode.png 913w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The XML approach is a bit more involved but is predictable and you don't have to save the file until you have the XML just the way you want it.<\/p>\n<p>One thing I will say about both techniques is that the more you understand how to use regular expressions in PowerShell the more you can accomplish. If you are feeling a little wobbly on the topic, there is an entire chapter on regular expressions in <a href=\"http:\/\/affiliate.manning.com\/idevaffiliate.php?id=1210&url=24\" title=\"get a copy\" target=\"_blank\">PowerShell in Depth<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve just finished up a series of tweets with a follower who had a question about finding and replacing a bit of data in a text file. In his case it was a web.config file but it really could be any text file that you can view in PowerShell. In PowerShell 3.0 and later this&#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":"Find and Replace Text with #PowerShell http:\/\/wp.me\/p1nF6U-Y7","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[359,8],"tags":[123,102,534,250,456,206,457],"class_list":["post-3727","post","type-post","status-publish","format-standard","hentry","category-powershell-3-0","category-scripting","tag-files","tag-get-content","tag-powershell","tag-regular-expressions","tag-select-xml","tag-xml","tag-xpath"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Find and Replace Text with 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\/scripting\/3727\/find-and-replace-text-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Find and Replace Text with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve just finished up a series of tweets with a follower who had a question about finding and replacing a bit of data in a text file. In his case it was a web.config file but it really could be any text file that you can view in PowerShell. In PowerShell 3.0 and later this...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-02-27T14:08:54+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.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\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Find and Replace Text with PowerShell\",\"datePublished\":\"2014-02-27T14:08:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/\"},\"wordCount\":421,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/magnifying-glass.png\",\"keywords\":[\"Files\",\"Get-Content\",\"PowerShell\",\"Regular Expressions\",\"Select-XML\",\"xml\",\"XPath\"],\"articleSection\":[\"Powershell 3.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/\",\"name\":\"Find and Replace Text with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/magnifying-glass.png\",\"datePublished\":\"2014-02-27T14:08:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#primaryimage\",\"url\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/magnifying-glass.png\",\"contentUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/magnifying-glass.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3727\\\/find-and-replace-text-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Powershell 3.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-3-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Find and Replace Text with 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":"Find and Replace Text with 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\/scripting\/3727\/find-and-replace-text-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Find and Replace Text with PowerShell &#8226; The Lonely Administrator","og_description":"I've just finished up a series of tweets with a follower who had a question about finding and replacing a bit of data in a text file. In his case it was a web.config file but it really could be any text file that you can view in PowerShell. In PowerShell 3.0 and later this...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-02-27T14:08:54+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.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\/scripting\/3727\/find-and-replace-text-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Find and Replace Text with PowerShell","datePublished":"2014-02-27T14:08:54+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/"},"wordCount":421,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png","keywords":["Files","Get-Content","PowerShell","Regular Expressions","Select-XML","xml","XPath"],"articleSection":["Powershell 3.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/","name":"Find and Replace Text with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png","datePublished":"2014-02-27T14:08:54+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#primaryimage","url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png","contentUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3727\/find-and-replace-text-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Powershell 3.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},{"@type":"ListItem","position":2,"name":"Find and Replace Text with 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":4752,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4752\/updating-open-live-writer-auto-links-with-powershell\/","url_meta":{"origin":3727,"position":0},"title":"Updating Open Live Writer Auto Links with PowerShell","author":"Jeffery Hicks","date":"January 4, 2016","format":false,"excerpt":"I'm sure it comes as no surprise to you that I do a fair bit of blogging and writing. This means I am always on the look out for tools and tricks to make the process easier. Recently Scott Hanselmen and others announced a resurrection of the old Microsoft Live\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"Open LIve Writer","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/01\/image_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5112,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5112\/creating-git-commit-messages-with-powershell\/","url_meta":{"origin":3727,"position":1},"title":"Creating Git Commit Messages with PowerShell","author":"Jeffery Hicks","date":"June 21, 2016","format":false,"excerpt":"As part of my process of learning an using Git I am trying to get in the habit of using meaningful commit messages. Sure, you can get by with a single line comment which is fine when running git log --oneline. But you can use a multi-line commit message. However,\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2390,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2390\/get-acl-information-with-powershell\/","url_meta":{"origin":3727,"position":2},"title":"Get ACL Information with PowerShell","author":"Jeffery Hicks","date":"June 21, 2012","format":false,"excerpt":"I got a question in the \"Ask Don and Jeff\" forum on PowerShell.com that intrigued me. The issue was working with the results of the Get-ACL cmdlet. The resulting object includes a property called Access which is a collection of access rule objects. Assuming you are using this with the\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\/2012\/06\/get-aclinfo-1-300x77.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4332,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4332\/friday-fun-open-last-file-in-the-powershell-ise\/","url_meta":{"origin":3727,"position":3},"title":"Friday Fun: Open Last File in the PowerShell ISE","author":"Jeffery Hicks","date":"March 27, 2015","format":false,"excerpt":"Over the last few articles I've been sharing some shortcuts to get most recently used or edited files. For today's Friday Fun I thought I'd share something that I use in my PowerShell ISE profile. Whenever I start the ISE, I automatically open the last file I was working on.\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":3562,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3562\/friday-fun-theme-me-up\/","url_meta":{"origin":3727,"position":4},"title":"Friday Fun: Theme Me Up!","author":"Jeffery Hicks","date":"November 15, 2013","format":false,"excerpt":"When PowerShell 3.0 came out, one of the compelling features was a re-vamped PowerShell ISE. Options in the ISE included the ability to fine-tune and customize the appearance including items like font, token colors, and screen colors. If I recall correctly, in PowerShell 2.0, if you wanted to customize the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"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":7409,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7409\/importing-pester-results-into-powershell\/","url_meta":{"origin":3727,"position":5},"title":"Importing Pester Results into PowerShell","author":"Jeffery Hicks","date":"April 24, 2020","format":false,"excerpt":"Last week, a PowerShell scripting challenge was posted on the Iron Scripter web site.\u00a0 The idea was that when you run a Pester test, you can save the results to a specially formatted\u00a0 XML file. Invoke-Pester C:\\scripts\\sample.test.ps1 -OutputFile d:\\temp\\results.xml -OutputFormat JUnitXml I get this result. The challenge was to write\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/informationvariable-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/informationvariable-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/informationvariable-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/informationvariable-1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/informationvariable-1.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3727","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=3727"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3727\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}