Undo the check out of a file from SharePoint 2010 document library using web service in powershell

Steps Involved:

  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
## Input Parameters required for undo the check out of a file from document library
$uri="http://serverName:10736/sites/ECT/_vti_bin/Lists.asmx?wsdl"
[
string]$pageUrl="http://serverName:10736/sites/ECT/Shared Documents/BIVisioDiagram.vsd"



$listWebServiceReference
= New-WebServiceProxy -Uri $uri -UseDefaultCredential
$listWebServiceReference.UndoCheckOut($pageUrl)