Freigeben über


MOSS 2007 - Find the default view url for all lists in a web app using PowerShell

 param
(
    $url = $(Read-Host -Prompt "WebApp Url")
)
# Default View for lists in All Sites
# Lookup Web Application as specified in the command line parameter
$wa = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($url) 
# Create an array 
$sites =@()
Write-Output("`nProcessing sites...`n") 
# Loop through all site collections in the web application
foreach($site in $wa.Sites)
{
    foreach ($s in $site)
    {
        $spWeb = $s.openweb()
            foreach($list in $spweb.lists)
            {
                Write-Host "list:", $list.defaultview.url
            }
    }
}