Skip to main content
1 of 2

This one works for me. Thanks pholpar

$impitem = $impweb.GetListItem('http://sp2013/XXXXXXXXXXXXXX.xlsx');
$impFile = $impItem.File
$ft = New-Object System.TimeSpan(10000);
$impfile.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft)
$impfile.UndoCheckOut();
$impfile.Delete();