cls
function Get-DocInventory($Url) {
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$site = new-object Microsoft.SharePoint.SPSite $Url
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
if ($list.BaseType -ne "DocumentLibrary") {
continue
}
foreach ($item in $list.Items) {
#Write-Host $item.name.ToString().ToLower()
if ($item.name.ToString().ToLower().Endswith(".mp4") -or $item.name.ToString().ToLower().Endswith(".avi") -or $item.name.ToString().ToLower().Endswith(".wmv") -or $item.name.ToString().ToLower().Endswith(".mov") -or $item.name.ToString().ToLower().Endswith(".flv")){
$data = @{
#"Web Application" = $webApp.ToString()
# "Site" = $site.Url
"Web" = $web.Url
"list" = $list.Title
"Item ID" = $item.ID
"Item URL" = $item.Url
"Item Title" = $item.Title
"Item Created" = $item["Created"]
"Item Modified" = $item["Modified"]
"Item Modified By" = $item['Editor']
"File Size" = $item.File.Length/1KB
}
New-Object PSObject -Property $data
Write-Host $item.name.ToString()
}
}
}
#$web.Dispose();
}
}
function Get-DocInventory($Url) {
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$site = new-object Microsoft.SharePoint.SPSite $Url
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
if ($list.BaseType -ne "DocumentLibrary") {
continue
}
foreach ($item in $list.Items) {
#Write-Host $item.name.ToString().ToLower()
if ($item.name.ToString().ToLower().Endswith(".mp4") -or $item.name.ToString().ToLower().Endswith(".avi") -or $item.name.ToString().ToLower().Endswith(".wmv") -or $item.name.ToString().ToLower().Endswith(".mov") -or $item.name.ToString().ToLower().Endswith(".flv")){
$data = @{
#"Web Application" = $webApp.ToString()
# "Site" = $site.Url
"Web" = $web.Url
"list" = $list.Title
"Item ID" = $item.ID
"Item URL" = $item.Url
"Item Title" = $item.Title
"Item Created" = $item["Created"]
"Item Modified" = $item["Modified"]
"Item Modified By" = $item['Editor']
"File Size" = $item.File.Length/1KB
}
New-Object PSObject -Property $data
Write-Host $item.name.ToString()
}
}
}
#$web.Dispose();
}
}
No comments:
Post a Comment