I'm trying to run this PowerShell script in Jenkins:
if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.TeamFoundation.PowerShell
}
Update-TFSWorkspace -Overwrite -Recurse -Item C:\myWorkSpaceFolder
Jenkins returns the error "Unable to determine the workspace." I can run the above code on the server that Jenkins is using and it works.
Any idea how I can fix this? In case it matters, this is how Jenkins is executing the script:
powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\hudson3811725198776907360.ps1'"
I'm running Jenkins 2.6. I'm using version 1.3 of the PowerShell plugin (https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin). I'm not using the Jenkins TFS plugin because of How to stop Jenkins from listing all TFS workspaces.
Thanks.