{"id":6196,"date":"2022-03-09T09:42:00","date_gmt":"2022-03-09T07:42:00","guid":{"rendered":"https:\/\/lazyadmin.nl\/?p=6196"},"modified":"2022-03-08T17:42:53","modified_gmt":"2022-03-08T15:42:53","slug":"substring","status":"publish","type":"post","link":"https:\/\/lazyadmin.nl\/powershell\/substring\/","title":{"rendered":"How-to use Substring in PowerShell"},"content":{"rendered":"\n<p>When you want to extract a part of a string in PowerShell we can use the Substring() method. This method allows us to specify the start and length of the substring that we want to extract from a string.<\/p>\n\n\n\n<p>In this article, I will explain how the Substring method works, and show you a couple of examples of how to get parts of a string using the startIndex and\/or length function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using the Substring Method in PowerShell<\/h2>\n\n\n\n<p>The Substring method can be used on any string object in PowerShell. This can be a literal string or any variable of the type string.<\/p>\n\n\n\n<p>To use the method we will need to specify the starting point of the string that we want to extract. Optionally we can specify the length (number of characters), that we want to extract.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Substring(startIndex, length)<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Tip<\/p><cite>Keep in mind that a string starts at position 0 and not 1<\/cite><\/blockquote>\n\n\n\n<p>This method is best explained with the help of examples, so let&#8217;s start with the following famous string &#8220;hello world&#8221;. To extract only the word <em>world<\/em> from the string we can use the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\"Hello World\".Substring(6)\n\n# Result\nWorld<\/pre>\n\n\n\n<p>We have only specified the start point of the substring, 6. This way the method will extract all characters starting from position 6 of the string.<\/p>\n\n\n\n<p>To explain the position of each character a bit better, I have numbered the position below each letter of the string. As you can see, position 6 is the letter <strong>W<\/strong>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Hello World\n012345678910<\/pre>\n\n\n\n<p>If we only want to extract the word <em>Hello<\/em> from the string, then we need to specify the startIndex of 0 and a length of 5 characters:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\"Hello World\".Substring(0,5)\n\n# Result\nHello<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Working with Dynamic Strings<\/h3>\n\n\n\n<p>When working with dynamic strings you don&#8217;t always know the length of the string. For this, we can use the string length function inside the substring method.<\/p>\n\n\n\n<p>Let&#8217;s say we have a folder with log files from which we want to extract the filenames without the extension. The filename itself can have different lengths, but the extension, in this case, is 3 letters and a dot.<\/p>\n\n\n\n<p>So the keep only the filenames we can get the length of the filename and subtract 4 characters from it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$filename = \"la-ams-file02-log-1.log\"\n\n$filename.Substring(0, $filename.Length - 4)\n\n# Result\nla-ams-file02-log-1<\/pre>\n\n\n\n<p>We can also use this the other way around to get only the extensions from the filenames. We determine the start position based on the length of the filename, and specify a length of 3 characters:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$filename = \"la-ams-file02-log-1.log\"\n$filename.Substring($filename.Length - 3, 3)\n\n# Result\nlog<\/pre>\n\n\n\n<p>In this case, we actually don&#8217;t need to specify the length of the substring to return (3), because we can simply return the remaining characters:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$filename.Substring($filename.Length - 3)\n\n# Result\nlog<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Using IndexOf in Substring<\/h3>\n\n\n\n<p>When working with dynamics string lengths you sometimes want to extract a part in the middle of the string. The challenge then is to find\/calculate the exact starting position for the substring method.<\/p>\n\n\n\n<p>One option to do this is to use IndexOf. This method allows you to find the position of a character or string inside a string.<\/p>\n\n\n\n<p>Let&#8217;s go back to our log files example. I have added a totally useless date format to it, with inconsistent length. To get only the date from the name of the log files, we can use the <code>IndexOf()<\/code> method.<\/p>\n\n\n\n<p>We are going to search in the string for the unique part before the date <code>-log<\/code>. The IndexOf method will return the starting position of the string or character that you searched for, so in this case, we will need to add 4 characters to it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$files = @(\n    'la-ams-ad01-log-202223.log',\n    'la-ams-ad01-log-2022113.log',\n    'la-osl-ad01-log-2022113.log',\n    'la-osl-file01-log-202214.log'\n)\n$files | Foreach {\n    # Get the position of the substring 'log-' in each filename and add 4 to this position.\n    $part = $_.Substring($_.IndexOf('log-') + 4)\n    # Returns 202223.log for example\n \n    # Remove the extension from the substring\n    $date = $part.Substring(0, $part.Length - 4)\n    write-host $date\n    # Returns 202223 for example\n}\n<\/pre>\n\n\n\n<p>In this particular case, you could also use the method <code>LastIndexOf()<\/code> in the hyphens in the names of the files:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$files | Foreach {\n    $part = $_.Substring($_.LastIndexOf('-') + 1)\n    write-host $part\n\n    $date = $part.Substring(0, $part.Length - 4)\n    write-host $date\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>When working with strings in PowerShell you will probably be using the substring method quite a lot. Keep in mind that you can always combine the substring method with other string operators like split or <a href=\"https:\/\/lazyadmin.nl\/powershell\/powershell-replace\/\">replace<\/a>.<\/p>\n\n\n\n<p>I hope you found this article useful, if you have any questions, just drop a comment below.<\/p>\n<script async src=\"https:\/\/alatus.eocampaign1.com\/form\/d0ce5de8-9b48-11ee-8cf4-eb425eea7369.js\" data-form=\"d0ce5de8-9b48-11ee-8cf4-eb425eea7369\"><\/script>","protected":false},"excerpt":{"rendered":"<p>When you want to extract a part of a string in PowerShell we can use the Substring() method. This method allows us to specify the start and length of the substring that we want to extract from a string. In &#8230; <a title=\"How-to use Substring in PowerShell\" class=\"read-more\" href=\"https:\/\/lazyadmin.nl\/powershell\/substring\/\">Read more<span class=\"screen-reader-text\">How-to use Substring in PowerShell<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":6198,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[69],"tags":[22],"class_list":["post-6196","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershell"],"wppr_data":{"cwp_meta_box_check":"No"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How-to use Substring in PowerShell &#8212; LazyAdmin<\/title>\n<meta name=\"description\" content=\"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lazyadmin.nl\/powershell\/substring\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How-to use Substring in PowerShell &#8212; LazyAdmin\" \/>\n<meta property=\"og:description\" content=\"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lazyadmin.nl\/powershell\/substring\/\" \/>\n<meta property=\"og:site_name\" content=\"LazyAdmin\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/lazyadminnl\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/lazyadminnl\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-09T07:42:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rudy Mens\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/lazyadmin\" \/>\n<meta name=\"twitter:site\" content=\"@lazyadmin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rudy Mens\" \/>\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:\/\/lazyadmin.nl\/powershell\/substring\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/\"},\"author\":{\"name\":\"Rudy Mens\",\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952\"},\"headline\":\"How-to use Substring in PowerShell\",\"datePublished\":\"2022-03-09T07:42:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/\"},\"wordCount\":639,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952\"},\"image\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg\",\"keywords\":[\"Powershell\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/lazyadmin.nl\/powershell\/substring\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/\",\"url\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/\",\"name\":\"How-to use Substring in PowerShell &#8212; LazyAdmin\",\"isPartOf\":{\"@id\":\"https:\/\/lazyadmin.nl\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg\",\"datePublished\":\"2022-03-09T07:42:00+00:00\",\"description\":\"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function\",\"breadcrumb\":{\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lazyadmin.nl\/powershell\/substring\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage\",\"url\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg\",\"contentUrl\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg\",\"width\":800,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lazyadmin.nl\/powershell\/substring\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lazyadmin.nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How-to use Substring in PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lazyadmin.nl\/#website\",\"url\":\"https:\/\/lazyadmin.nl\/\",\"name\":\"LazyAdmin\",\"description\":\"Tips and howto&#039;s about Office 365, PowerShell, Home network and smart devices\",\"publisher\":{\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lazyadmin.nl\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952\",\"name\":\"Rudy Mens\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2024\/06\/Profile-photo-2024-Ruud.jpg\",\"contentUrl\":\"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2024\/06\/Profile-photo-2024-Ruud.jpg\",\"width\":500,\"height\":500,\"caption\":\"Rudy Mens\"},\"logo\":{\"@id\":\"https:\/\/lazyadmin.nl\/#\/schema\/person\/image\/\"},\"description\":\"Ruud worked for more than 15 years as a SysAdmin in the Netherlands and is now working as an independent consultant. In his spare time, he loves to thinker with Smart Devices.\",\"sameAs\":[\"https:\/\/lazyadmin.nl\",\"https:\/\/www.facebook.com\/lazyadminnl\/\",\"http:\/\/nl.linkedin.com\/in\/rudymens\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/lazyadmin\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How-to use Substring in PowerShell &#8212; LazyAdmin","description":"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function","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:\/\/lazyadmin.nl\/powershell\/substring\/","og_locale":"en_US","og_type":"article","og_title":"How-to use Substring in PowerShell &#8212; LazyAdmin","og_description":"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function","og_url":"https:\/\/lazyadmin.nl\/powershell\/substring\/","og_site_name":"LazyAdmin","article_publisher":"https:\/\/www.facebook.com\/lazyadminnl\/","article_author":"https:\/\/www.facebook.com\/lazyadminnl\/","article_published_time":"2022-03-09T07:42:00+00:00","og_image":[{"width":800,"height":450,"url":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg","type":"image\/jpeg"}],"author":"Rudy Mens","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/lazyadmin","twitter_site":"@lazyadmin","twitter_misc":{"Written by":"Rudy Mens","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#article","isPartOf":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/"},"author":{"name":"Rudy Mens","@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952"},"headline":"How-to use Substring in PowerShell","datePublished":"2022-03-09T07:42:00+00:00","mainEntityOfPage":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/"},"wordCount":639,"commentCount":1,"publisher":{"@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952"},"image":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage"},"thumbnailUrl":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg","keywords":["Powershell"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lazyadmin.nl\/powershell\/substring\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/","url":"https:\/\/lazyadmin.nl\/powershell\/substring\/","name":"How-to use Substring in PowerShell &#8212; LazyAdmin","isPartOf":{"@id":"https:\/\/lazyadmin.nl\/#website"},"primaryImageOfPage":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage"},"image":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage"},"thumbnailUrl":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg","datePublished":"2022-03-09T07:42:00+00:00","description":"Everything you need to know about using the Substring method in PowerShell. Extract part of a string with this powerfull function","breadcrumb":{"@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lazyadmin.nl\/powershell\/substring\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#primaryimage","url":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg","contentUrl":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg","width":800,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/lazyadmin.nl\/powershell\/substring\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lazyadmin.nl\/"},{"@type":"ListItem","position":2,"name":"How-to use Substring in PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/lazyadmin.nl\/#website","url":"https:\/\/lazyadmin.nl\/","name":"LazyAdmin","description":"Tips and howto&#039;s about Office 365, PowerShell, Home network and smart devices","publisher":{"@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lazyadmin.nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/cbfba61543b21fbba63cfbf62f08d952","name":"Rudy Mens","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/image\/","url":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2024\/06\/Profile-photo-2024-Ruud.jpg","contentUrl":"https:\/\/lazyadmin.nl\/wp-content\/uploads\/2024\/06\/Profile-photo-2024-Ruud.jpg","width":500,"height":500,"caption":"Rudy Mens"},"logo":{"@id":"https:\/\/lazyadmin.nl\/#\/schema\/person\/image\/"},"description":"Ruud worked for more than 15 years as a SysAdmin in the Netherlands and is now working as an independent consultant. In his spare time, he loves to thinker with Smart Devices.","sameAs":["https:\/\/lazyadmin.nl","https:\/\/www.facebook.com\/lazyadminnl\/","http:\/\/nl.linkedin.com\/in\/rudymens\/","https:\/\/x.com\/https:\/\/twitter.com\/lazyadmin"]}]}},"uagb_featured_image_src":{"full":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",800,450,false],"thumbnail":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring-150x150.jpg",150,150,true],"medium":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring-300x169.jpg",300,169,true],"medium_large":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring-768x432.jpg",768,432,true],"large":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",800,450,false],"1536x1536":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",800,450,false],"2048x2048":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",800,450,false],"post-thumb":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",800,450,false],"post-thumb-half":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring-400x225.jpg",400,225,true],"wppr-widget":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring-50x28.jpg",50,28,true],"gform-image-choice-sm":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",300,169,false],"gform-image-choice-md":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",400,225,false],"gform-image-choice-lg":["https:\/\/lazyadmin.nl\/wp-content\/uploads\/2022\/03\/substring.jpg",600,338,false]},"uagb_author_info":{"display_name":"Rudy Mens","author_link":"https:\/\/lazyadmin.nl\/author\/lajcud8123b\/"},"uagb_comment_info":1,"uagb_excerpt":"When you want to extract a part of a string in PowerShell we can use the Substring() method. This method allows us to specify the start and length of the substring that we want to extract from a string. In ... Read moreHow-to use Substring in PowerShell","_links":{"self":[{"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/posts\/6196"}],"collection":[{"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/comments?post=6196"}],"version-history":[{"count":0,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/posts\/6196\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/media\/6198"}],"wp:attachment":[{"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/media?parent=6196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/categories?post=6196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lazyadmin.nl\/wp-json\/wp\/v2\/tags?post=6196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}