0

I am trying to get the latest for a user on a build server. I have created a powershell script to do this and the script finishes successfully but the folder isn't updated. If I open a powershell session and go through line by line typing them out manually it works. But running the script does not.

$tf = 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\TF.exe '
$s = New-PSSession -ComputerName server -Credential user
Invoke-Command $s -ScriptBlock{
cd c:\inetpub\wwwroot\sqlwebservice 
& $args[0] @('get ', '. ', '/r')
cd SyncService
dir
exit
} -ArgumentList ($tf) 
Pause

Any ideas? Thanks.

Adam
  • 89
  • 1
  • 1
  • 7
  • Did you run the script as part of your build process or just run it on your local machine? – PatrickLu-MSFT Feb 21 '17 at 02:52
  • I run it on my local machine. It updates a folder for a generic login that runs the builds. This way I can check-in changes to an XML, run this script, and the user that runs the builds gets updated with out me having to remote to that server. – Adam Feb 21 '17 at 13:28

1 Answers1

0

According to your situation, if it works line by line and not work as a script. You can wait on the job to finish with a timeout (in case the command hangs) by using -Timeout. Take a look at below two links:

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62