Approve files in library
$siteUrl="https://blogs/blog3"
$web=get-spweb $siteUrl
$folder=$web.GetFolder("Pages") #("_catalogs/masterpage")
$files=$folder.Files
$layouts=@($files["NewsLayoutDetails.aspx"])
write-host "Approving files..."
# check-in
foreach($spFile in $files) #$layouts)
{
if($spfile.checkOutStatus -ne "None" -and $spfile.checkOutStatus -ne $null)
{
$spfile.checkIn("Checked in by Powershell", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
}
}
write-host "Files approved."