Force UndoCheckout or checkin using PowerShell in SharePoint 2013

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can forcefully UndoCheckOut a page using PowerShell in SharePoint 2013. Sometimes when you will try using browser you will not be able to UndoCheckout a apage. In that case PowerShell will be very much helpful.

You can read:
– Dictionary actions example in SharePoint Designer 2013

– SharePoint 2013 Calculate business day from InfoPath date picker or Get Day from selected date in Date picker in InfoPath 2013

– Get All Attachments From SharePoint 2013 List Item using Rest API

Below is the PowerShell command to UndoCheckOut default.asxp page from Pages document library.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”
$targetWeb = “https://SiteURL”
$targetLibrary = “Pages”
$fileName = “default.aspx”

$myWeb = Get-SPWeb $targetWeb
$myLib = $myWeb.GetFolder($targetLibrary)
$myFile = $myLib.Files | ? {$ -eq $fileName}



Also you can use the below PowerShell command:
$web = Get-SPWeb https://SiteURL
$list = $web.Lists[“Pages”]
$file = $list.GetItemById(1); // ID of the file with the issue

You can check the item id from the Pages document library from the document library.

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

View all posts by Bijay Kumar →

Leave a Reply