Enumerating The Site Collection And Sub-Site Using PowerShell In SharePoint 2013

This blog may help you to collect all the site collection and subsites within the Web application and also here I am going to extract some columns like Title, URL, Author, Created, LastModifiedDate, Parent web and Unique permission sites.
This script may help you in some way for auditing your SharePoint web application. 
  1. $webapp =Read-Host "Enter the Web Application URL"  
  2. $siteColl =Get-SPSite -WebApplication $webapp  
  4. Foreach($web in $siteColl)  
  5. {  
  6.     Get-SPWeb -Site $web | Select Title, URL, Author, Created, LastModifiedDate, Parentweb, HasUniqueRolesAssignments | FT -AutoSize  

  7. }  
And the result will be like the below screen.
Then if you want to extract this report in a CSV file you can add Export-CSV -Path C:\temp\report.csv at the end of line 6 like below,
  1. Get-SPWeb -Site $url | Select Title, URL, Author, Created, LastItemModifiedDate, ParentWeb, HasUniqueRoleAssignments | Export-CSV -Path C:\report.csv -Append