Add-PSSnapin
Microsoft.SharePoint.PowerShell
$SiteCollections
=
$SPwebApp
.Sites
$SiteCollections
|
ForEach-Object
{
$SubSites
= $_.AllWebs
$SubSites
|
ForEach-Object
{
$Site
= $_
$lists
=
$Site
.Lists |
Where-Object
{ $_.BaseType
-eq
'GenericList'
}
$lists
|
ForEach-Object
{
New-Object
-TypeName
PSObject
-Property
@{
ListName = $_.Title
SiteName =
$Site
.Title
SiteUrl =
$Site
.Url
}}}}|
Export-CSV
"C:\\All-Lists.csv"
-NoTypeInformation
-Encoding
UTF8
Get all Document Libraries in a SharePoint web application
Add-PSSnapin
Microsoft.SharePoint.PowerShell
-ErrorAction
SilentlyContinue
$SiteCollections
=
$SPwebApp
.Sites
$SiteCollections
|
ForEach-Object
{
$SubSites
= $_.AllWebs
$SubSites
|
ForEach-Object
{
$Site
= $_
$lists
=
$Site
.Lists |
Where-Object
{ $_.BaseType
-eq
'DocumentLibrary'
}
$lists
|
ForEach-Object
{
New-Object
-TypeName
PSObject
-Property
@{
LibraryName = $_.Title
SiteName =
$Site
.Title
SiteUrl =
$Site
.Url
}}}}|
Export-CSV
"C:\\All-Libraries.csv"
-NoTypeInformation
-Encoding
UTF8
No comments:
Post a Comment