Good day. I created a tfs-workspace on a remote computer, and worked with it in Visual Studio. All fine, check-ins and check-outs work correctly. Today I decided to automate some tasks, but Powershell tools throws various error during working with this workspace.
I checked scripts' work on local folder - all fine. I've tried to use variations of UNC paths (FileSystem::myPath), Resolve-Path, Get-ChildItem, Get-TfsChildItem, but all of it doesn,t work. tf checkout even can't determine the workspace.
Are there any variants to work with a workspace on remote computer in PowerShell?
P.S. TFS, VS, TFPT of 13th version. P.P.S. I can't use "net use" or it's analogue.
P.P.P.S Commands and results:
Microsoft.PowerShell.Core\FileSystem::\\srv-tfsmain\D$\NetWorkspace\MyUser\Test> tf checkout 15
tf : Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
Microsoft.PowerShell.Core\FileSystem::\\srv-tfsmain\D$\NetWorkspace\MyUser\Test> Add-TfsPendingChange -edit 15
Add-TfsPendingChange : The filename, directory name, or volume label syntax is incorrect. $path
Microsoft.PowerShell.Core\FileSystem::\\srv-tfsmain\D$\NetWorkspace\MyUser\Test> Add-TfsPendingChange -edit (Resolve-Path 15)
Add-TfsPendingChange : Cannot bind parameter 'Item'. Cannot convert the "Microsoft.PowerShell.Core\FileSystem::\\srv-tfsmain\D$\NetWorkspace\MyUser\Test\15" value of type "System.Management.Automation.PathInfo" to type "Microsoft.TeamFoundation.PowerTools.PowerShell.QualifiedItemSpec".
Upd 1. The error was in the incorrect path: Workspace was mapped to \srv-tfsmain\NetWorkspace\MyUser\Test, and i used command in \srv-tfsmain\D$\NetWorkspace\MyUser\Test. After correcting path, tf works fine, but
Add-TfsPendingChange -edit
doesn't work with any form of UNC path.
convert-path
to determine the real path of the remote workspace path of yours, link here – Beytan Kurt