SP 2013 Publish Master page gallery using Powershell script

The below script will be useful for approving the master page gallery files using Powershell script


Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
$strStatusApproved= [Microsoft.SharePoint.SPModerationStatusType]::Approved;
$strStatusRejected= [Microsoft.SharePoint.SPModerationStatusType]::Rejected;
$strStatusPending= [Microsoft.SharePoint.SPModerationStatusType]::Pending;
$webAppUrl = "http://SPSiteURL"
function fnCheckInFolder($folder)
{
if($folder-ne $null -and $folder.item -ne $null -and $folder.item.ModerationInformation -ne $strStatusApproved -and $folder.item.ModerationInformation -ne $strStatusRejected )
{
write-host (" Approving the folder {0} " -f $folder.item.Url)
$comment = $folder.item.ModerationInformation
$comment.Status = $strStatusApproved
$folder.Item.Update()
$folder.update()
}
$j=0
if($folder-ne $null -and $folder.Url.Contains("/img") -eq $true)
{

$folder.Files |?{ $_.Item -ne $null -and $_.Item.File.CheckOutType -ne “None”} | % {
$_.Item[“ContentTypeId”]=”0x010100C5033D6CFB8447359FB795C8A73A2B19″
$_.Item.Update()
$_.Item.File.CheckIn(“”)
$_.Item.file.Publish(“”)
$_.Item.file.Approve(“”)

}
}
$folder.Files | ?{ $_.Item -ne $null -and $_.Item.Properties[“HtmlDesignLockedFile”] -eq $null -and $_.MinorVersion -ne 0 } | %{
if($_.Url.Contains(“.html”) ){
# design file .html master page checkin
$_.Item[“ContentTypeId”]=”0x0101000F1C8B9E0EB4BE489F09807B2C53288F0054AD6EF48B9F7B45A142F8173F171BD10003D357F861E29844953D5CAA1D4D8A3A”
$_.Item.Update()
$_.Item.File.CheckIn(“”)
$_.Item.file.Publish(“”)
$_.Item.file.Approve(“”)
Write-Host (” Master page {0} status ” -f $_.Url,$_.item.File.CheckOutStatus);

}

if($_.Url.Contains(“.css”) -or $_.Url.Contains(“.js”)) {

$i =0
if ($_.Item.File.CheckOutType -ne “None”)
{
# design files css/js checkin
Write-Host (” Items Publishing {0} ” -f $_.Url,$_.Item.ContentType.Name );
$_.Item[“ContentTypeId”]=”0x010100C5033D6CFB8447359FB795C8A73A2B19″
$_.Item.Update()
$_.Item.File.CheckIn(“”)
$_.Item.file.Publish(“”)
$_.Item.file.Approve(“”)
}

}

}

$folder.SubFolders | %{ fnCheckInFolder $_;}
}

$rootWeb = Get-SPWeb $webAppUrl
$rootWeb.Title
$masterPageFolder= $rootWeb.GetFolder(“_catalogs/masterpage”)
fnCheckInFolder($masterPageFolder)

 

SSRS 2012 installation failed in SharePoint 2013 integrated mode

SSRS 2012 installation in SharePoint 2013 integration mode , sometimes failed. It may be the due to the SharePoint web applications web.config file may contains < ! - - comments - - > lines (this is one of the reason for the failure)

Try to remove the comments < ! - - comments - - > lines lines  and try to install.

It’s better to install SSRS in SharePoint 2013 server at initial stage so that before customizing the web.config (with comments lines) to avoid this problem.

Hope this may helpful for someone.

SharePoint Central Administration Application Pool is stopping automatically

In SharePoint 2013/2010 sometimes CA application pool may be stopped automatically, even after giving correct service account password.

This may be related to huge log files added into the 15\Logs folder, clear some of the old logs will help to resolve the issue. Alternatively always set the log folder size (in GB) in CA -> Monitoring -> diagnostics logging section. This will avoid the issues.

Warm-up Script for Web Front End Servers (WFE) in Load Balanced SharePoint Farms

There is a great article on warming up all WFE servers using Powershell scripts

https://blogs.technet.microsoft.com/scottstewart/2014/09/29/warm-up-script-for-web-front-end-servers-wfe-in-load-balanced-sharepoint-farms/

 

Thanks to Scott for creating the PowerShell script.