I have the following powershellscript, and I would like to rewrite it so if it finds this exception it should continue to the next web.
$webapplication = Get-SPWebApplication "https://notadummsite.com"
foreach($site in $webapplication.Sites)
{
foreach($subWeb in $site.AllWebs)
{
if( $subWeb.AllProperties["WebTemplate"] -eq "Job" -or $subWeb.AllProperties["WebTemplate"] -eq "Opportunity")
{
try {
Write-Host $subWeb.Url
$SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($subWeb)
$SPPubWeb.Navigation.InheritGlobal = $true
$SPPubWeb.Update()
Write-Host 'Updated'
}
catch{
Write-Host $subWeb.Url
Write-Host $error[0]
}
}
$subweb.Dispose()
}
$site.Dispose()
}