Reputation: 8711
I've spent the last week developing a Powershell script. It now works ok when I start it from a Powershell window. However, I need the script to be called from TFS build. I've tried using the syntax Powershell & 'script' from a TFS Build InvokeProcess control but nothing seems to happen. So, I've gone back to basics and created the following script:
Write-Host " Write-Host line"
Write-eventlog -logname "Application" -source "BizTalkDeployment" -eventId "01" -entrytype "Information" -message "test"
I've saved the script as c:\temp\ps_test.ps1. I've opened a command window as admin and tried the following:
powershell & 'c:\temp\ps_test.ps1"
This puts the command line into powershell mode and I get:
PS c:\>
But nothing else happens.
At the end of my TFS build I have an InvokeProcess control that uses "Powershell" for its FileName property and then the following arguments:
String.Format(" ""& '{0}' '{1}' '{2}' '{3}' '{4}' '{5}' '{6}' '{7}' '{8}' '{9}' "" ", DeploymentScriptFileName, IO.Path.GetDirectoryName(DeploymentScriptFileName), "ExecuteBizTalkAppMSI.ps1", "bin\debug\x.Int.MIS-3.0.0.msi", "x.Int.MIS.Deployment.btdfproj", TargetServerPath, "d-vasbiz01", "c:\biztalkdeployment", "C:\Program Files (x86)\x.Int.MIS for BizTalk 2010\3.0", "BTSSvc*MIS*")
The build script runs ok but the InvokeProcess control seems to do nothing - just like my experience with the command line.
Can anyone see where I'm going wrong please?
Upvotes: 1
Views: 2435
Reputation: 354396
Either
powershell -file C:\temp\ps_test.ps1
or
powershell "&{ <# code here #> }"
Upvotes: 3