Backup web.config
From Brian Cartmel
#Define variables $webappName = "http://bc01" # $webappName = "SharePoint - 80" $backupDir = "C:\backups" Write-Host "Backing up $webappName web.config file…" -foreground Gray –nonewline ## Get the web application – by display name $w = Get-SPWebApplication | where { $_.DisplayName -eq "$webappName"} ## Get the default (first) zone for the web app… ## You may wish to iterate through all the available zones $zone = $w.AlternateUrls[0].UrlZone ## Get the collection of IIS settings for the zone $iisSettings = $w.IisSettings[$zone] ## Get the path from the settings $path = $iisSettings.Path.ToString() + "\web.config" ## copy the web.config file from the path copy-item $path -destination $backupDir\$webappName Write-Host "done" -foreground Green


