Home > Uncategorized > SharePoint 2007/2010: Get All Sites, Lists Names, List Paths, Items Count, Versions, and Last Items Modified Using PowerShell

SharePoint 2007/2010: Get All Sites, Lists Names, List Paths, Items Count, Versions, and Last Items Modified Using PowerShell

If you need to get a list of all Sites, Lists Names, Paths, Item Count, Versions, and Last Modified for a specific Site within your SharePoint 2010 enviornment you can utilize the following powershell script to generate a .txt file that will provide you with that needed information.

I created this script for MOSS 2007, but it can also be utilized in your SP2010 environment.

————————————————————————————————————
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bc111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bc111e9429c”)

$SPSite = New-Object Microsoft.SharePoint.SPSite(https://portal)
$total_lists = 0
$many_vers = 0

$SPSite.AllWebs | ForEach-Object {
$weburl = $_.ServerRelativeUrl
$_.Lists | ForEach-Object {

if ($_.Hidden -eq $false) {

write-output “Site – $($_.ParentWebUrl), List Name – $($_.Title), Path – $($_.ParentWebUrl)/$($_.RootFolder), Item Count – $($_.Items.Count), Last Modified – $($_.LastItemModifiedDate)” >> all_lists.txt
$total_lists += 1
}

$_.Items | ForEach-Object {
if ($_.Versions.Count -ge 10) {
write-output “$($_.Versions.Count)’t$(weburl)/$($_.url)” >> many_vers.txt
}
}
}

$_.close()
$_.dispose()
}

—————————————————————————————————————

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: