Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to loop through all site collection in a web app and I have to extract the list name called "Project Center" and list down all the list properties. Help required.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This should do it

$spWebApp = Get-SPWebApplication "http://myapplication.sharepoint.com/"

function getListProperties ($spweb)
{
    foreach ($spList in $spweb.Lists | Where {$_.Title -eq "Project Center"})
    {
        Write-Host "List found in: $($spweb.Url)"
        $spList.PSObject.Properties | Select-Object Name,Value
    }

    foreach ( $subweb in $spweb.Webs)
    {
        getListProperties $subweb
    }

    $spweb.Dispose()
}


foreach ($spSite in $spWebApp.Sites)
{
    Write-Host "Looking in $($spSite.Url)..."
    $rootWeb = $spSite.RootWeb
    getListProperties $rootWeb
}

Don't forget to replace the spweb application URL with your SharePoint URL.

share|improve this answer
    
Am getting the following errrors: You cannot call a method on a null-valued expression.;;The term 'Get-SPWebApplication' is not recognized as the name of a cmdlet, function, script file, or operable program. ;;;'getListProperties' is not recognized as the name of a cmdlet. Am unable to solve these errors.(I have replaced the webapp url). –  priya Jan 2 '14 at 4:49
    
Make sure you are running this in the sharepoint management shell so that the sharepoint snapin is already loaded. –  BlueBird Jan 2 '14 at 13:51
    
Hi, the above code worked for me for retrieving list prperties using powershell. I need one more help for display the list properties by exporting it to .csv(export in excel). suggestions are welcome. thanks –  priya Jan 7 '14 at 10:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.