List WebUIversion (SharePoint version) of all webs in SharePoint Farm.
# ----------------------------------------------
# Author: Iulian Atodiresei
# Date: 09.04.2013
# Description: List WebUIversion (SharePoint version) of all webs in SharePoint Farm.
# ----------------------------------------------
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
$webapps = @()
write-output "WebApplication;URL Collection de sites;URL Site;Version UI" | out-file -filepath output.csv -append
foreach ($websvc in $websvcs) {
foreach ($webapp in $websvc.WebApplications) {
#write-output "$($webapp.Name);;;;"
foreach ($site in $webapp.Sites) {
#write-output ";$($site.URL);;;"
foreach ($web in $site.AllWebs) {
#write-output ";;$($web.URL);$($web.UIVersion)"
write-output "$($webapp.Name);$($site.URL);$($web.URL);$($web.UIVersion)" | out-file -filepath output.csv -append
}
}
}
}