He developed a short little set of PowerShell Functions that can take ownership of the files, then recursively check in all files that are being checked out by the system account.
tryt his
#Add SharePoint Snapin if not using SharePoint's PowerShell Console
if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
#First function takes ownerhip of all unmanaged files with no version
function Take-Ownership{
param(
$spSite,
$spList
)
$site = Get-SPWeb -Identity $spSite
$list = $site.Lists[$spList]
$list.CheckedOutFiles | ForEach-Object{
$_.LeafName+ " had it's ownership taken from: "+$_.CheckedOutBy.DisplayName+"`n"
$_.TakeOverCheckOut()
}
}
#This Function takes a folder object and recursively checks in
#all files which are checked out by the System Account
function checkin-AllFiles{
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[Microsoft.SharePoint.SPFolder]
$currFolder
)
$currFolder.Files | ForEach-Object {
if ($_.CheckedOutByUser.UserLogin -eq "SHAREPOINT\system"){
$_.CheckIn("File checked in by administrator")
$_.Name+" has been checked in`n"
}
}
$currFolder.SubFolders| ForEach-Object{
checkin-AllFiles -currFolder $_
}
}
#This function basically combines the previous 2 for primary use
function Checkin-AllUnmanagedFiles{
param(
$site,
$library
)
$spSite = Get-SPWeb -identity $site
$spFolder = $spSite.Folders[$library]
Get-Date
"Taking ownership of the following Files`n"
Take-Ownership -spSite $site -spList $library
"-----------------------------------------------------------------------------`n"
Get-Date
"Checking in the following files`n"
checkin-AllFiles -currFolder $spFolder
Get-Date
}
https://brenthafnersblog.wordpress.com/2012/10/16/manage-files-which-have-no-checked-in-version-list-larger-than-list-view-threshold/