PowerShell to check document library versioning setting

watch I had this requirement where I had to loop through all the Webs and create a report on how many document libraries do not have versioning enabled.

Depakote back order I found this blog post which actually does something similar but it checks the version size.

buy cheap viagra online with prescription http://www.sharepointdiary.com/2013/01/document-versions-size-report-powershell.html

I have updated the script for my requirements and I am sharing with you guys in case if someone had the same requirements.

Add-PSSnapin Microsoft.SharePoint.PowerShell

#Replace the URL with your Web Application

 $WebAppURL = "http://intranet.contoso.com";

 #Get the Web Application

    $WebApp=Get-SPWebApplication($WebAppURL);

    #Write the CSV Header - Tab Separated

 "Site Name`t Site URL `t Library `t Versioning Enabled" | out-file C:\temp\DocLibVersioningReport.csv ;

 #Loop through each site collection

  foreach($Site in $WebApp.Sites)

   {

    #Loop through each site in the site collection

     foreach($Web in $Site.AllWebs)

        {

            #write-host $Web.Title;

            #Loop through  each List

            foreach ($List in $Web.Lists)

            {

                #Get only Document Libraries & Exclude Hidden System libraries

                if ( ($List.BaseType -eq "DocumentLibrary") -and ($List.Hidden -eq $false) )

                {   

                     "$($Web.Title) `t $($Web.Url) `t $($List.Title) `t $($List.EnableVersioning)" | Out-File C:\temp\DocLibVersioningReport.csv -Append ;                    

                }

            }

       $Web.Dispose() ;        

        }

 $Site.Dispose() ;        

    } 

    write-host "Report Generated Successfully!" ;