How to iterate thru all SiteCollections and containing the Websites. This script also shows a progressbar on screen:
$sites = Get-SPSite -Limit All $siteIter = 0 foreach($site in $sites) { Write-Progress -PercentComplete (($siteIter / $sites.Count) * 100) -Activity "Iteration Sites" -Status $site.HostName $webIter = 0 # Do something here foreach($web in $site.AllWebs) { Write-Progress -PercentComplete (($webIter / $site.AllWebs.Count) * 100) -Activity "Iteration Webs" -Status $web.Title -Id 2 Write-Host $web.Title $webIter++ # Do something here } $siteIter++ }
I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site. Sportwetten Tipps
ReplyDelete