{"id":75851,"date":"2016-01-09T16:01:00","date_gmt":"2016-01-09T16:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/01\/09\/weekend-scripter-unexpected-case-sensitivity-in-powershell\/"},"modified":"2019-02-18T09:20:20","modified_gmt":"2019-02-18T16:20:20","slug":"weekend-scripter-unexpected-case-sensitivity-in-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-unexpected-case-sensitivity-in-powershell\/","title":{"rendered":"Weekend Scripter: Unexpected Case Sensitivity in PowerShell"},"content":{"rendered":"<p align=\"left\"><b>Summary<\/b>: PowerShell MVP, Mike F Robbins, discusses case sensitivity in Windows PowerShell.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Robbins.<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/MikeRobbins.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/MikeRobbins.PNG\" alt=\"Photo of Mike Robbins\" title=\"Photo of Mike Robbins\" \/><\/a><\/p>\n<p style=\"margin-left:30px\">Mike F Robbins is a Microsoft MVP for Windows PowerShell and a SAPIEN Technologies MVP. He is a co-author of <i>Windows PowerShell TFM 4<sup>th<\/sup> Edition<\/i>, and is a contributing author of a chapter in the <i>PowerShell Deep Dives<\/i> book. Mike has written guest blog posts for the Hey, Scripting Guy! Blog, PowerShell Magazine, and PowerShell.org. He is the winner of the advanced category in the 2013 PowerShell Scripting Games. Mike is also the leader and co-founder of the <a href=\"http:\/\/mspsug.com\/\" target=\"_blank\">Mississippi PowerShell User Group<\/a>. He blogs at <a href=\"http:\/\/mikefrobbins.com\/\" target=\"_blank\">mikefrobbins.com<\/a> and can be found on twitter <a href=\"https:\/\/twitter.com\/mikefrobbins\">@mikefrobbins<\/a>.<\/p>\n<p>A few months ago I wrote a blog post called <a href=\"http:\/\/mikefrobbins.com\/2015\/10\/15\/some-cases-of-unexpected-case-sensitivity-in-powershell\/\" target=\"_blank\">Some Cases of Unexpected Case Sensitivity in PowerShell<\/a>, and I thought I would expand on that topic a bit here as a sequel to that original post.<\/p>\n<p>Everything is case insensitive in PowerShell, right? Well, that&rsquo;s what we&rsquo;re normally taught, but it&rsquo;s actually not quite that simple. The answer to whether PowerShell is case sensitive is, &ldquo;It depends.&rdquo; In general, PowerShell is not case sensitive, but there are a number of caveats to case sensitivity, some of which are intentional, and some that are unexpected.<\/p>\n<h3>Operators<\/h3>\n<p>By default, the comparison operators that you&rsquo;ll commonly see used with PowerShell are case insensitive. These include:<\/p>\n<div class=\"WordSection2\">\n<ul>\n<li>-eq<\/li>\n<li>-ne<\/li>\n<li>-gt<\/li>\n<li>-ge<\/li>\n<li>-lt<\/li>\n<li>-le<\/li>\n<li>-like<\/li>\n<li>-notlike<\/li>\n<li>-match<\/li>\n<li>-notmatch<\/li>\n<li>-contains<\/li>\n<li>-notcontains<\/li>\n<li>-in<\/li>\n<li>-notin<\/li>\n<li>-replace<\/li>\n<\/ul>\n<\/div>\n<p>Each of these comparison operators have a corresponding case-sensitive version:<\/p>\n<div class=\"WordSection4\">\n<ul>\n<li>-ceq<\/li>\n<li>-cne<\/li>\n<li>-cgt<\/li>\n<li>-cge<\/li>\n<li>-clt<\/li>\n<li>-cle<\/li>\n<li>-clike<\/li>\n<li>-cnotlike<\/li>\n<li>-cmatch<\/li>\n<li>-cnotmatch<\/li>\n<li>-ccontains<\/li>\n<li>-cnotcontains<\/li>\n<li>-cin<\/li>\n<li>-cnotin<\/li>\n<li>-creplace<\/li>\n<\/ul>\n<\/div>\n<p>Each of these operators also has a case-insensitive version that begins with an <b>i<\/b> instead of a <b>c<\/b>. These versions are explicitly case insensitive, although you&rsquo;ll rarely (if ever) see them used because their behavior is the same as where <b>i<\/b> or <b>c<\/b> is not specified.<\/p>\n<div class=\"WordSection5\">\n<p>Here is an example of using these operators:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &#039;PowerShell&#039; -eq &#039;powershell&#039;<\/p>\n<p style=\"margin-left:30px\">True<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &#039;PowerShell&#039; -ceq &#039;powershell&#039;<\/p>\n<p style=\"margin-left:30px\">False<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &#039;PowerShell&#039; -ieq &#039;powershell&#039;<\/p>\n<p style=\"margin-left:30px\">True<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<p>To learn more about comparison operators, see the about_Comparison_Operators Help topic in PowerShell or view the online version: <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/hh847759.aspx\" target=\"_blank\">about_Comparison_Operators<\/a>.<\/p>\n<h3>Escape characters<\/h3>\n<p>All of the alphabet-based escape characters are case sensitive:<\/p>\n<\/div>\n<div class=\"WordSection6\">\n<ul>\n<li>`a&nbsp;&nbsp;&nbsp; Alert<\/li>\n<li>`b&nbsp;&nbsp;&nbsp; Backspace<\/li>\n<li>`f&nbsp;&nbsp;&nbsp; Form feed<\/li>\n<li>`n&nbsp;&nbsp;&nbsp; New line<\/li>\n<li>`r&nbsp;&nbsp;&nbsp; Carriage return<\/li>\n<li>`t&nbsp;&nbsp;&nbsp; Horizontal tab<\/li>\n<li>`v&nbsp;&nbsp;&nbsp; Vertical tab<\/li>\n<\/ul>\n<\/div>\n<p>The special meaning of these characters doesn&rsquo;t occur when an upper-case character is specified, for example:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &quot;Hey, Scripting `n Guy! Blog&quot;<\/p>\n<p style=\"margin-left:30px\">Hey, Scripting<\/p>\n<p style=\"margin-left:30px\">&nbsp;Guy! Blog<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &quot;Hey, Scripting `N Guy! Blog&quot;<\/p>\n<p style=\"margin-left:30px\">Hey, Scripting N Guy! Blog<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<p>To learn more about escape characters, see the about_Escape_Characters Help topic in PowerShell or view the online version: <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/hh847755.aspx\" target=\"_blank\">about_Escape_Characters<\/a>.<b><\/b><\/p>\n<h3>Region and EndRegion tags<\/h3>\n<p>Regions were introduced in Windows PowerShell&nbsp;3.0. Specifying the <b>#region<\/b> or <b>#endregion<\/b> tags in anything other than lower-case letters breaks the ability to collapse that portion of the code.<\/p>\n<h3>External technologies<\/h3>\n<p>When you&rsquo;re using PowerShell to access information from a technology that&rsquo;s outside of PowerShell, such as from Active Directory with ADSI, the rules for case sensitivity in PowerShell no longer apply. An example is shown in the following function. If the case for <b>samaccountname<\/b> is changed inside of <b>pscustomobject<\/b>, the <b>samaccountname<\/b> will not be returned.<\/p>\n<p style=\"margin-left:30px\">#Requires -Version 3.0<\/p>\n<p style=\"margin-left:30px\">function Get-MrADUser {&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; [CmdletBinding()]<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; param(<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Parameter(Mandatory,<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValueFromPipeline,<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValueFromPipelineByPropertyName)]<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [String[]]$UserName<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; )&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; PROCESS {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($user in $UserName){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $Search = [adsisearcher]&quot;(&amp;(objectCategory=person)(objectClass=user)(samaccountname=$user))&quot;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($user in $($Search.FindAll())){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$stringSID = (New-Object -TypeName System.Security.Principal.SecurityIdentifier($($user.Properties.objectsid),0)).Value<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $objectGUID = [System.Guid]$($user.Properties.objectguid)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [pscustomobject]@{<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;DistinguishedName = $($user.Properties.distinguishedname)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Enabled = (-not($($user.GetDirectoryEntry().InvokeGet(&#039;AccountDisabled&#039;))))<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GivenName = $($user.Properties.givenname)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name = $($user.Properties.name)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectClass = $($user.Properties.objectclass)[-1]<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectGUID = $objectGUID<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SamAccountName = $($user.Properties.samaccountname)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SID = $stringSID<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Surname = $($user.Properties.sn)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserPrincipalName = $($user.Properties.userprincipalname)<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-left:30px\">}<\/p>\n<h3>Cmdlets<\/h3>\n<p>Some cmdlets have parameters to control case sensitivity. One example is the <b>Sort-Object<\/b> cmdlet, which has a <b>CaseSensitive<\/b> parameter. Specifying this parameter when using <b>Sort-Object<\/b> indicates that the sort should be case sensitive. By default, sorting with <b>Sort-Object<\/b> is case insensitive. Here are some examples:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &#039;PowerShell&#039;, &#039;powershell&#039;, &#039;POWERSHELL&#039; | Sort-Object<\/p>\n<p style=\"margin-left:30px\">POWERSHELL<\/p>\n<p style=\"margin-left:30px\">powershell<\/p>\n<p style=\"margin-left:30px\">PowerShell<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; &#039;PowerShell&#039;, &#039;powershell&#039;, &#039;POWERSHELL&#039; | Sort-Object -CaseSensitive<\/p>\n<p style=\"margin-left:30px\">powershell<\/p>\n<p style=\"margin-left:30px\">PowerShell<\/p>\n<p style=\"margin-left:30px\">POWERSHELL<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<h3>Switch statements<\/h3>\n<p>Case-insensitive switch statements are not supported in PowerShell workflows. For more detailed information about this topic and to learn how to work around this, see the following Hey, Scripting Guy! Blog post: <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/powershell-workflows-restrictions\/\" target=\"_blank\">PowerShell Workflows: Restrictions<\/a>.<\/p>\n<h3>Hash tables<\/h3>\n<p>Hash tables are case insensitive by default. Notice that I can&rsquo;t add <b>ComputerName<\/b> and <b>computername<\/b> to the hash table in the following example because, by default, the keys are the same:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable = @{}<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable.Add(&#039;ComputerName&#039;, &#039;PC01&#039;)<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable.Add(&#039;computername&#039;, &#039;pc01&#039;)<\/p>\n<p style=\"margin-left:30px\">Exception calling &quot;Add&quot; with &quot;2&quot; argument(s): &quot;Item has already been added. Key in dictionary: &#039;ComputerName&#039;&nbsp; Key<\/p>\n<p style=\"margin-left:30px\">being added: &#039;computername&#039;&quot;<\/p>\n<p style=\"margin-left:30px\">At line:1 char:1<\/p>\n<p style=\"margin-left:30px\">+ $hashtable.Add(&#039;computername&#039;, &#039;pc01&#039;)<\/p>\n<p style=\"margin-left:30px\">+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; + CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : NotSpecified: (:) [], MethodInvocationException<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; + FullyQualifiedErrorId : ArgumentException<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<p>A special case-sensitive hash table can be created though. Notice in the following example, I can add the two keys that failed in the previous example:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable = New-Object -TypeName System.Collections.Hashtable<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable.Add(&#039;ComputerName&#039;, &#039;PC01&#039;)<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable.Add(&#039;computername&#039;, &#039;pc01&#039;)<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $hashtable<\/p>\n<p style=\"margin-left:30px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<\/p>\n<p style=\"margin-left:30px\">&#8212;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8211;<\/p>\n<p style=\"margin-left:30px\">ComputerName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PC01<\/p>\n<p style=\"margin-left:30px\">computername&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pc01<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<h3>JSON<\/h3>\n<p>JSON is case sensitive, but the custom objects that are created when using the <b>ConvertFrom-Json<\/b> cmdlet are case insensitive. For more detailed information abouit JSON, see this Hey, Scripting Guy! Blog post: <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/json-is-the-new-xml\/\" target=\"_blank\">JSON Is the New XML<\/a>.<\/p>\n<h3>Methods<\/h3>\n<p>As you can see in the following example, methods such as <b>contains<\/b> and <b>replace<\/b> are case sensitive, whereas the <b>contains<\/b> and <b>replace<\/b> operators are not case sensitive.<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $Features = &#039;SQLENGINE&#039;, &#039;SSMS&#039;, &#039;ADV_SSMS&#039;<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $Features.Contains(&#039;SQLENGINE&#039;)<\/p>\n<p style=\"margin-left:30px\">True<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $Features -contains &#039;SQLENGINE&#039;<\/p>\n<p style=\"margin-left:30px\">True<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $Features.Contains(&#039;SQLEngine&#039;)<\/p>\n<p style=\"margin-left:30px\">False<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $Features -contains &#039;SQLEngine&#039;<\/p>\n<p style=\"margin-left:30px\">True<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;<\/p>\n<p>Do you think that you&rsquo;ll outsmart the case-sensitivity issues in PowerShell by using the <b>ToUpper<\/b> or <b>ToLower<\/b> method to convert strings to a specific case before performing comparison operations on them? Not so fast. You could be creating a different problem&mdash;especially if you&rsquo;re potentially working with other cultures. If you&rsquo;re thinking about going this route, consider reading my blog post <a href=\"http:\/\/mikefrobbins.com\/2015\/10\/22\/using-pester-to-test-powershell-code-with-other-cultures\/\">Using Pester to Test PowerShell Code in Other Cultures<\/a>.<\/p>\n<p>~Mike<\/p>\n<p>Thanks for clarifying a somewhat confusing issue for us, Mike.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: PowerShell MVP, Mike F Robbins, discusses case sensitivity in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Robbins. Mike F Robbins is a Microsoft MVP for Windows PowerShell and a SAPIEN Technologies MVP. He is a co-author of Windows PowerShell TFM 4th Edition, and is a contributing author [&hellip;]<\/p>\n","protected":false},"author":597,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,344,3,4,336,134,61,45],"class_list":["post-75851","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-mike-f-robbins","tag-scripting-guy","tag-scripting-techniques","tag-strings","tag-troubleshooting","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: PowerShell MVP, Mike F Robbins, discusses case sensitivity in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Robbins. Mike F Robbins is a Microsoft MVP for Windows PowerShell and a SAPIEN Technologies MVP. He is a co-author of Windows PowerShell TFM 4th Edition, and is a contributing author [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/75851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/597"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=75851"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/75851\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=75851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=75851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=75851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}