Hi anonymous user ,
Could you please add more detailed information about your needs or issues? Is the requirement to view the audit data or list all sites?
Per my understanding, if you want to see the audit data, you need to wait for your timer job to run after completing the settings, and your report will be automatically generated to the library you specify.
================================
Or if it is to list all sites and subsites, you could try the following script:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
$siteUrl = Read-Host "Enter Site URL"
$rootSite = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$spWebApp = $rootSite.WebApplication
$count = 0
write-host "Site Collections"
write-host ""
foreach ($site in $spWebApp.Sites) {
$count++
write-host "Site Collections URL --> -->" $site.URL
write-host ""
write-host "SubSites"
write-host ""
foreach ($web in $site.AllWebs) {
$count++
write-host "SubSite URL --> --> -->" $web.URL
write-host ""
}
}
write-host "Total Count :" $count
Result:
Reference:
List of Sites and Subsites
If the answer is helpful, please click "Accept Answer" and upvote it.
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.