There is no way do this in SPO using PowerShell. Similar question was discussed here
Summarize answer from the above thread:
"The technical reason behind this is not possible in SPO using PoerShell is the SOM property locktype is not there and neither is the method ReleaseLock.
So as this is not possible to release locks in SPO. If it is happening to you regularly raise a support call from your tenant admin center."
However, this is possible using SOM PowerShell:
$web = Get-SPWeb http://<site>/Ringo
$list = $web.Lists[“Shared Documents”]
$item = $list.GetItemById(171)
$file = $item.File
$userId = $file.LockedByUser.ID
$user = $web.AllUsers.GetByID($userId)
$impSite= New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken);
$impWeb = $impSite.OpenWeb();
$impList = $impWeb.Lists[$list.Title]
$impItem = $impList.GetItemById($item.ID)
$impFile = $impItem.File
Some other way of troubleshooting from your client machine:
- Make sure the "webclient service" on client side is running
- Find registry key:
HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters on their machines.
- Find value: SupportLocking(if no, please add), set its value to 0,want to just disable lock feature.
This disables the locking feature via the registry and does not impact any other services.
I would suggest that you test it one 1 machine first to see if it resolves the issue prior to pushing it out to all production machines.
More on this troubleshooting:
Cannot Release Lock on SharePoint Online File