PtiTom

Extract SharePoint 2007 Item Sizes

Apr 2nd, 2015
234
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #cd /d "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
  2. #stsadm.exe -o enumsites -url "WebAppURL"
  3. [Reflection.Assembly]::LoadFrom("C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.SharePoint.dll")
  4.  
  5. function Extract-Web ($web)
  6. {
  7.     foreach($subWeb in $web.GetSubwebsForCurrentUser())
  8.     {
  9.         Extract-Web $subWeb
  10.     }
  11.    
  12.     $webUrl = $web.Url
  13.     foreach($list in $web.Lists)
  14.     {
  15.         $listTitle = $list.Title
  16.         $itemCount = $list.ItemCount
  17.         $lastUpdate = $list.LastItemModifiedDate
  18.         $lastDelete = $list.LastItemDeletedDate
  19.         "LIST`t$webUrl`t$listTitle`t`t`t$itemCount`t$lastUpdate`t$lastDelete"
  20. #       | Export-csv -PAth Export.csv -Append
  21.  
  22.         foreach ($docItem in $list.Items)
  23.         {
  24.             $docFile = $docItem.File;
  25.             if ($docFile)
  26.             {
  27.                 $name = $docFile.Name
  28.                 $size = $docFile.Length
  29.                 $ver = $docItem.Versions.Count
  30.                 $crea = $docFile.TimeCreated
  31.                 $upd = $docFile.TimeLastModified
  32.                 "DOC`t$webUrl`t$listTitle`t$name`t$size`t$ver`t$crea`t$upd"
  33.             }
  34.         }
  35.     }
  36.    
  37.     $web.Dispose();
  38. }
  39.  
  40.  
  41. $site = New-Object "Microsoft.SharePoint.SPSite" "SPSiteURL"
  42. $rootWeb = $site.RootWeb
  43. $url = $site.Id
  44.  
  45. Extract-Web $rootWeb > "Export$url.tsv"
  46.  
  47. $site.Dispose();
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×