Get Web App Db’s:
Get-SPContentDatabase -WebApplication http://demo.Test.com | select -expand name |out-file "d:\sp\sp patching\dbinfo\demo.txt"
Remove Web App Db’s:
Get-SPContentDatabase -WebApplication http://demo.Test.com | Dismount-SPContentDatabase
Add Db’s to Web App:
$dbs = @(Get-Content -path "d:\sp\sp patching\dbinfo\tpm.txt" )
For ($ii=0; $ii -le $dbs.Length - 1;$ii++)
{
Mount-SPContentDatabase -Name $dbs[$ii] -WebApplication http://demo.Test.com
}
Get-SPContentDatabase -WebApplication http://demo.Test.com | select -expand name |out-file "d:\sp\sp patching\dbinfo\demo.txt"
Remove Web App Db’s:
Get-SPContentDatabase -WebApplication http://demo.Test.com | Dismount-SPContentDatabase
Add Db’s to Web App:
$dbs = @(Get-Content -path "d:\sp\sp patching\dbinfo\tpm.txt" )
For ($ii=0; $ii -le $dbs.Length - 1;$ii++)
{
Mount-SPContentDatabase -Name $dbs[$ii] -WebApplication http://demo.Test.com
}