Check in and Check out default page using PowerShell in SharePoint 2013

InfoPath alternatives for form designing SharePoint

In this post we will discuss how to checkin and checkout using PowerShell in SharePoint 2013. Below example we will see how to checkout and checkin using PowerShell.

You may like to see:
– How to Set up your SharePoint 2013 Online Management Shell to connect to SharePoint online sites?

– Workflow Internal Status Suspended error in SharePoint 2013

– SharePoint 2016 new features

Below is the PowerShell command which will checkout and checkin all the site’s default.aspx page and subsites under the site collection.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

$SPsite = Get-SPSite “https://SiteURL”

foreach ($SPweb in $SPsite.AllWebs)

{

#$SPweb | Select-Object -Property Title,Url,WebTemplate

$SPFile = $SPWeb.GetFile(“default.aspx”);

$SPFile.CheckOut(“Online”,$null);

$SPFile.CheckIn(1);

$SPweb.Dispose()

}

$SPsite.Dispose()

Below is the PowerShell command which will checkin or checkout a particular sub site (here in this example it will checkin checkout the default.aspx of Mysubsite subsite).

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

$SPsite = Get-SPSite “https://SiteURL”

foreach ($SPweb in $SPsite.AllWebs)

{

if($SPweb.Url -eq “https://SiteURL/Mysubsite”)

{

#$SPweb | Select-Object -Property Title,Url,WebTemplate

$SPFile = $SPWeb.GetFile(“default.aspx”);

$SPFile.CheckOut(“Online”,$null);

$SPFile.CheckIn(1);

$SPweb.Dispose()

}

}

$SPsite.Dispose()

Hope this will be helpful.

Similar SharePoint 2013 Tutorials

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply