# encoding: ascii
# api: powershell
# title: Update web.config
# description: The beauty of IIS web.config files is they are just text files. This function can be used to update values such as computer names in connection strings or any other matched string. Note that the replace function is case sensitive.
# version: 0.1
# type: function
# author: anonymous
# license: CC0
# function: Update-WCContents
# x-poshcode-id: 4000
# x-archived: 2015-05-05T01:18:18
# x-published: 2015-03-06T21:06:00
#
# Update-WCContents -File C:\folder\web.config -SearchString “some value” -NewValue “some new value”
#
Function Update-WCContents($File,$SearchString,$NewValue){
$Contents = Get-Content -Path $File
$Contents | %{$_.Replace($SearchString,$NewValue)} | Set-Content $File
} # End Update-WCContents Function