Skip to content

Instantly share code, notes, and snippets.

@mika76
Created November 18, 2024 10:43
Show Gist options
  • Save mika76/f9f966d9bd504c819f7ff11452b5aea4 to your computer and use it in GitHub Desktop.
Save mika76/f9f966d9bd504c819f7ff11452b5aea4 to your computer and use it in GitHub Desktop.
TFS Delete Workspaces owner by user
# Tries to match everything until the owner field as the workspace name (thanks redgate sql source control)
tf workspaces /owner:domain\username|
Select-Object -Skip 2 |
ForEach-Object {
if ($_ -match "^(.*?)Username") {
$workspace = $Matches[1].Trim()
Write-Host "Will delete workspace: $workspace"
tf workspace /delete "$workspace;domain\username" /noprompt
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment