SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make some changes to all of the document libraries in a site collection, but not make changes to any other lists. In PowerShell, how can I check whether a list is a document library, or a different kind of list?

share|improve this question
up vote 6 down vote accepted

To see the all the lists in a site, and if they are a document library or not, this PowerShell script should be helpful:

$web = get-spweb http://<your site url>
$lists = $web.lists
foreach ($list in $lists) {
   write-host $list.title, "(", $list.BaseType, ")"

I ran this on one of my sites, and it returned a mix of "GenericList" and "DocumentLibrary" as the BaseType property.

You can also look at the property $list.BaseTemplate along with $BaseType to narrow down the number of system generated document libraries that are returned.


share|improve this answer
I chose this as the answer because it was very helpful to have all of the lists and their types as output. Quick note though, in the first line "get-spweb" should not have a dollar sign in front of it. – LCountee Nov 21 '11 at 20:01

Assuming you have instance of SPList in powershell, the BaseType of list would be SPBaseType.DocumentLibrary for list of type document library.

So that check may look like

if (oListObject.BaseType -eq [Microsoft.SharePoint.SPBaseType]::DocumentLibrary) {


share|improve this answer

Your Answer


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.