I have the following PowerShell script:
$RegExplorer = Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters $NullSessionPipes = "$($RegExplorer.NullSessionPipes)" $NullSessionPipes $NullSessionPipes = $NullSessionPipes.replace("browser", "") $NullSessionPipes
The script works fine as long as the registry key examining exactly matches the case I've specified – "browser".
However if the case was different in the registry key say "BROWSER" or "Browser" it doesn't do the replacement.
I'm looking for some way to make string.replace case insensitive. I know I could convert the string using .tolower or .toupper first to make comparison easier, but I don't know if this particular registry key or applications which access it are case sensitive, so I don't want to change the case of existing key.
Is there an easy way to do this?