PowerShell to Update Alerts in SharePoint

Was reading Mikes post about Alerts not working in SharePoint 2010 and decided to convert his code to PowerShell. ¬†Read Mikes post before running this script….

$SiteCollection = Get-SPSite "http://YourSharePointSite/"

foreach ($subSite in $SiteCollection.AllWebs)
	{
		foreach($alrt in $subSite.Alerts)
			{
				$origTitle = $alrt.Title
                                $alrt.Title = "UPDATE: $origTitle"
                                $alrt.Update()

                                $alrt.Title = $origTitle
                                $alrt.Update()
				Write-Host $alrt.Title
			}
		$subSite.Dispose()
	}

$SiteCollection.Dispose()