Hi @SR VSP,
During my investigation, I found a post with the same needs as yours. The following code is for your reference:
Please run following PowerShell as administrator.
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0
Start-SPAssignment –Global
$spSites = Get-SPSite -Limit All
$spWAs = Get-SPWebApplication -IncludeCentralAdministration
$csvs = @()
#Get Web Application Data
Write-Host("Getting Web Application Data")
$spWAs | select Name, DisplayName, Id, Url, ApplicationPool, @{Expression={$_.ApplicationPool.Name}}, @{Expression={$_.ApplicationPool.UserName}}, DefaultQuotaTemplate | Export-CSV $bkdir\SPWebApplication.csv
$csvs += C:\SPWebApplication.csv
#Get Site Collection Data
Write-Host("Getting Site Collection Data")
$spSites | select Id, HostName, Url, Owner,WebApplication, ContentDatabase, RootWeb, LastContentModifiedDate, @{Expression={$_.Usage.Storage}} | Export-CSV $bkdir\SPSite.csv
$csvs += C:\SPSite.csv
#Get Site Data
Write-Host("Getting Site Data")
$spSites | Get-SPWeb -Limit All | select ID, Title, Author, Url, WebTemplate, LastItemModifiedDate, IsRootWeb | Export-CSV $bkdir\SPWeb.csv
$csvs += C:\SPWeb.csv
Stop-SPAssignment –Global
Reference:
https://gist.github.com/ciphertxt/52287bc26b8bc95a89d0
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards
Cheng Feng