PowerShell to Update the Search Target for a Site Collection

I was asked by a customer to produce a PowerShell script to iterate over all of the sites in a particular site collection and change the search target to the following address “http://[searchsite]/”.  This is the result of that request.

$site = Get—SPSite "http://[site]"
foreach ($web in $site.Allwebs) {
    Write—Host "Modifying all search result pages in site ($($web.Url))"
    $web.AllProperties["SRCH_ENH_FTR_URL"] =

This is based on a larger article I found here, which details a few more options you can set at the same time.