I'm trying to replace a part on a text file. First i searched if it is present in the text file
$check = Get-Content sample.txt | Where-Object {$_.Contains('<add key="IIS_VERSION" value="7" />')}
if ($checkIISv)
{
Write-Host "IIS's version is already 7"
}
else
{
Write-Host "Update IIS version to 7"
# I want to place here a code that will replace the value="7" if it is not =7
# This value is usually not 7
}
Please help, I dont think the replace function can be used here since the "value" is considered as unknown.