Aug 19, 2010 at 4:13 PM
Edited Aug 19, 2010 at 4:14 PM
I was creating a PowerShell script and got a syntax error on a cmdlet that is available
in PowerShell 2.0. I suspected that TFS Deployer might be running PowerShell 1.0 so I stuck the $Host.Version variable in the script and got the following when TFS Deployer responded to the build quality change event:
Team Project/Build: Client Tests to OnDemand
Quality Change: * to Released
Drop Location: \\WIN-RTEPE222REM\TfsBuilds\OnDemand\OnDemand_20100816.1
Build Uri: vstfs:///Build/Build/5
Executed on Machine: WIN-RTEPE222REM
Launched by TfsDeployer.
Major Minor Build Revision
----- ----- ----- --------
1 2 0 48385
How do I tell TFS Deployer to use Powershell 2.0 that is installed on the server?
Aug 19, 2010 at 9:20 PM
PowerShell v1 and PowerShell v2 don't install side-by-side. If PowerShell v2 is on your server, then TFS Deployer is using it. By checking $Host.Version you are checking the version of the host, not PowerShell. In this case the host is TFS Deployer itself
and version 22.214.171.124385 is the version of TFS Deployer. If you check $PSVersionTable instead you should get more detail on which version of what is running.
Also if you run "Get-Command -Noun WSMan*" (without quotes) you should see a list of about 13 cmdlets only introduced in PSv2, further confirming you are running v2.
Can you post the particular line of script generating the syntax error?