Somehow I have ended up with a \"ghost\" workspace. It doesn\'t show up in Visual Studio under Manage Workspaces. When I connect to VS Team Services and open source control expl
Buck is most certainly right about the identity issue. I stumbled upon it yesterday after an Azure AD migration. Fortunately there is a way around. Here is the PowerShell solution that I found with the help of the Team Foundation .NET assemblies. (For the record I am using PowerShell version 5.0.)
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Add-Type -AssemblyName 'Microsoft.TeamFoundation.VersionControl.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
$uri = 'https://me.visualstudio.com/defaultcollection' $tfs = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($uri) $vcs = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
$vcs.QueryWorkspaces('WorkspaceName', $null, $null) | % QualifiedName
You might have a look at the QueryWorkspaces online help. If the call to QueryWorkspaces()
does not return anything, which is the case if you only pass a computer name, you might have to issue it this way instead:
Invoke-Method -InputObject $vcs -MethodName 'QueryWorkspaces' -Arguments $null, $null, 'ComputerName' | % QualifiedName
It seems to be dued to the fact that $null
cannot be passed directly from within PowerShell. I had the issue before and this post helped me (but it seems to be now retired).
TF.exe
to delete the workspace (remember it is PowerShell, hence the --%
):tf workspace /collection:$uri --% /delete 'WorkspaceName;11111111-2222-3333-4444-555555555555'
Notice that you might as well call the Delete() method on the Workspace object returned by the QueryWorkspaces()
issued against VCS...
HTH