Sometimes small requirements take more time,

My colleague wanted to get all the sites , a web application has and he wanted to store it in an excel file.
After spending the whole day, Lately he came to me and asked me to help him with a script and lately publish it.
So here is the code.

This code will provide you the following fields in an excel file,

  1. Site’s Title
  2. Url
  3. Site’s ID
  4. Parent Web ID

Code

Get-SPWebApplication My web app here | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV FileLocationHere\File.csv –NoTypeInformation

Keep Learning,

Cheers.