Here's an example of a script to list all lists from a web site.
$siteName = 'http://localhost:81'
# param([string] $siteName)
[void] [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint' ) | Out-Null
$site = New-Object -TypeName Microsoft.SharePoint.SPSite $siteName
[Microsoft.SharePoint.SPWeb] $web = $site.OpenWeb()
[Microsoft.SharePoint.SPListCollection] $lists = $web.Lists
Write-Host $sites.Count
[Microsoft.SharePoint.SPList] $list = $null
[int] $iList = 0
for($iList = 0; $iList -lt $lists.Count; $iList++)
{
$list = $lists[$iList]
Write-Host $list.Title $list.TemplateFeatureId $list.BaseTemplate $list.ID
}
Write-Host 'The end'
No comments:
Post a Comment