Powershellscript to display all Checked Out Files (en)


Powershellscript to display all Checked Out Files de en Title
, , ,

With the following script you can display all your checked out files in your web.

Just save the script below as e.g. “DisplayAllCheckedOutFiles.ps1” and execute it within the SharePoint Management Shell (open it as Administrator is always a good idea).

Powershellscript to display all Checked Out Files (de en)_1

 

At the end of the script you can also specify if you want to save the results in a file.

Here a brief overview over my output:

Powershellscript to display all Checked Out Files (de en)_2

Powershellscript to display all Checked Out Files (de en)_3

Hope you like it and as always, don’t be afraIT to ask or comment.

# enter your site URL
$spWeb = Get-SPWeb "http://sp13"
 
function GetCheckedItems($spWeb)
{
Write-Host "Scanning Site: $($spWeb.Url)"
foreach ($list in ($spWeb.Lists | ? {$_ -is [Microsoft.SharePoint.SPDocumentLibrary]})) {
 Write-Host "Scanning List: $($list.RootFolder.ServerRelativeUrl)"
 foreach ($item in $list.CheckedOutFiles) {
 if (!$item.Url.EndsWith(".aspx")) { continue }
 $writeTable = @{
 "URL"=$spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)");
 "Checked Out By"=$item.CheckedOutBy;
 "Author"=$item.File.CheckedOutByUser.Name;
 "Checked Out Since"=$item.CheckedOutDate.ToString();
 "File Size (KB)"=$item.File.Length/1000;
 "Email"=$item.File.CheckedOutByUser.Email;
 }
 New-Object PSObject -Property $writeTable
 }
 foreach ($item in $list.Items) {
 if ($item.File.CheckOutStatus -ne "None") {
 if (($list.CheckedOutFiles | where {$_.ListItemId -eq $item.ID}) -ne $null) { continue }
 $writeTable = @{
 "URL"=$spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)");
 "Checked Out By"=$item.File.CheckedOutByUser.LoginName;
 "Author"=$item.File.CheckedOutByUser.Name;
 "Checked Out Since"=$item.File.CheckedOutDate.ToString();
 "File Size (KB)"=$item.File.Length/1000;
 "Email"=$item.File.CheckedOutByUser.Email;
 }
 New-Object PSObject -Property $writeTable
 }
 }
}
foreach($subWeb in $spWeb.Webs)
{
GetCheckedItems($subWeb)
}
$spWeb.Dispose()
}
 
GetCheckedItems($spWeb) | Out-GridView
 
# alternative output file
# GetCheckedItems($spWeb) | Out-File c:CheckedOutItems.txt -width 300

Leave a Reply

Your email address will not be published. Required fields are marked *