VSTS Release – PowerShell on Target Machines Quirk2

This is the second obscure issue I ran into while using the VSTS (TFS 2015 update 2) web based release management. Like the first, this occurred when trying to execute the PowerShell on Remote Machine task in a release. The error read like this:

##[error]The property 'Length' cannot be found on this object. Verify that the property exists.

I searched through my PowerShell that I was executing, as well as the actual PowerShell that made up the build task, and could not find anywhere that referenced Length on a variable. In the end, I commented out a line at a time in my PowerShell until I found the line causing the error. Turned out to be:

Set-StrictMode -Version 5.0

A bit of an oddity, but commenting out this fixed the error.

Tagged: Powershell, TFS Release,
Categorised: Team Foundation Server, VSTS,