Skip to content

Instantly share code, notes, and snippets.

@fluxdigital
Created December 16, 2022 00:21
Show Gist options
  • Save fluxdigital/991c766ec62f4e9abfcbd49dfdb03ebc to your computer and use it in GitHub Desktop.
Save fluxdigital/991c766ec62f4e9abfcbd49dfdb03ebc to your computer and use it in GitHub Desktop.
Unlock Items for User - ChatGPT
# Set the username of the user whose locked items you want to unlock
$username = "admin"
# Get a list of all items locked by the specified user
$lockedItems = Get-ChildItem -Path "master:\" -Recurse | Where-Object {
$_.Locking.IsLocked -and $_.Locking.LockedBy -eq $username
}
# Unlock all items in the list
foreach ($item in $lockedItems) {
$item.Editing.Unlock()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment