Created
September 16, 2019 03:51
-
-
Save Sumeet-Gandhi/4e55b20c97d3d2937ed6cc905079c9a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin Microsoft.SharePoint.Powershell | |
$webapp = Get-SPWebApplication https://abc.com | |
foreach($site in $webapp.Sites){ | |
$siteURL = $site.Url.ToLower().Replace("https://abc.com/clients/","") | |
Write-host | |
if($siteURL.StartsWith("m") -or $siteURL.StartsWith("n") -or $siteURL.StartsWith("o") -or $siteURL.StartsWith("p") -or $siteURL.StartsWith("q") -or $siteURL.StartsWith("r") -or $siteURL.StartsWith("s") -or $siteURL.StartsWith("t") -or$siteURL.StartsWith("u") -or $siteURL.StartsWith("v") -or $siteURL.StartsWith("w") -or $siteURL.StartsWith("x") -or $siteURL.StartsWith("y") -or $siteURL.StartsWith("z")) | |
{ | |
foreach($web in $site.AllWebs){ | |
#try{ | |
#$list = $web.GetList($web.Url + "/Documents")} | |
#catch | |
#{} | |
foreach ($list in $web.Lists) | |
{ | |
if($list.BaseTemplate -eq "DocumentLibrary") | |
{ | |
$foldercount = $list.Folders.Count | |
$itemcount = $list.ItemCount | |
$items = $itemcount - $foldercount | |
$listSize = 0 | |
$versions = 0 | |
foreach ($item in $list.items) | |
{ | |
$listSize += ($item.file).length | |
$versions = $versions + $item.Versions.Count | |
} | |
$sizeInMb = [Math]::Round((($listSize/1024)/1024),2) | |
if($list.Fields.ContainsField("PMO Tags")) | |
{ | |
$field = $list.Fields.GetField("PMO Tags") | |
$MMDField = $field.Group + "|" + $field.TermSetId | |
Write-host "Field Exist" | |
} | |
else | |
{ | |
$MMDField = " | " | |
} | |
Write-host $site.Url "|"$web.Url "|" $list.Title "|" $list.DefaultViewUrl "|" $foldercount "|" $items "|" $sizeInMb "|" $versions "|" $list.EnableVersioning "|" $MMDField | |
$value = $site.Url + "|" +$web.Url + "|" + $list.Title +"|" +$list.DefaultViewUrl +"|" +$foldercount +"|"+ $items +"|"+ $sizeInMb +"|" +$versions +"|"+ $list.EnableVersioning + "|" + $MMDField | |
Add-Content -Path e:\ps\ProjectReportExtended_v1.txt -Value $value | |
}} | |
$web.Dispose() | |
}} | |
$site.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment