Adam and Mathieu,
As far as I know the -match and -replace operators in PowerShell are case-insensitive. Below example works for me using a different set of test files of course.
$TextFiles = @('D:\MDTProduction\Control\Bootstrap.ini', 'D:\MDTProduction\Control\Customsettings.ini', 'D:\MDTBuildLab\Control\Bootstrap.ini', 'D:\MDTBuildLab\Control\Customsettings.ini', 'D:\MDTBuildLab\Scripts\Realocate.cmd' ) foreach ($FilePath in $TextFiles) { $Content = Get-Content $FilePath Write-Verbose "Searching for string in $FilePath" if ($Content -match 'mdt-01') { Write-Verbose "Found mdt-01 match in $FilePath" $Content = $Content -replace 'mdt-01', 'replacethis' Set-Content -Path $FilePath -Value $Content } }