Export ContentDataBase Name in csv file

<# Created by : Gaurav Goyal
   Purpose : To Export Content Database Name in csv file.
   Comments : Run With Admin Privileges \ Read operation.
#>

$csv="./CSV.csv"
$i=1;
SC $csv "ID,DBName,WebApplicationName,CurrentSiteCount"
write-host "`nGetting WebApplication Names`n";
$WebApps = Get-SPWebApplication 
foreach($WebAppUrl in $WebApps)
{
write-host "$i) Getting ContentDataBase name of WebApp" $WebAppUrl.Url "`n" ;$i++;
$toCSV=Get-SPContentDatabase -site $WebAppUrl.Url;
AC $csv "$($toCSV.Id),$($toCSV.Name),$($toCSV.WebApplication),$($toCSV.CurrentSiteCount)"
}
write-host "Exporting List of All DB.....`n"
Get-SPDatabase | epcsv ".\AllDataBaseList.csv"

Comments

Popular Posts

SharePoint Interview Questions and Answers

Download Infopath Form Templates

How to get current logged user information using JavaScript ?

Steps to set Form based authentication (FBA) for SharePoint 2010

SharePoint Interview Questions and Answers II

Get List Items - JavaScript

Change Language for current user with JSOM in SharePoint Online

Cross Site List Rollup Web Part for SharePoint 2010

Hide Recently Modified Items

SharePoint 2010 CSS Chart