I would like to see all files that are locked. so far, I\'ve only found to use tf.exe status and look for anything with \'!\' because they are not reported as \"lock, edit\" as
from your command prompt
>powershell
Then from powershell do:
PS > tf info * -recursive | &{
begin{
$out=@{}
$prefix = "loc"
}
process{
if ($_ -match "Local information"){
if ($out.Count -gt 0) {
[pscustomobject]$out
$out=@{}
$prefix = "loc"
}
} ElseIf ($_ -match "Server information"){
$prefix = "svr"
} else {
$parts = $_.Split(':')
if ($parts.Length -eq 2){
$out.Add($prefix + $parts[0].Trim(), $parts[1].Trim())
}
}
}
end{
if ($out.Count -gt 0) {
[pscustomobject]$out
}
}
} | where {!($_.svrLock -eq 'none')}