PowerShellOnTargetMachines TFS2015 Initialization Script not working

Hello,

I have a problem with getting PowerShellOnTargetMachines working during release while I provide Initialization Script.

The bottom line is I need to execute single ps1 DSC script on multiple servers while at the same time apply different parameters to each of those servers so thought I will just keep those parameters in psd1 file.

Here is my script LiquidDeploy.ps1:

Configuration LiquidDeploy
{
Node $AllNodes.ForEach(“NodeName”)
{
switch ($Node.Role)
{
“GW”
{
if ($NodeName -eq $env:COMPUTERNAME)
{
Write-Verbose $Node.Message
}
}
“APP”
{
if ($NodeName -eq $env:COMPUTERNAME)
{
Write-Verbose $Node.Message
}
}
default { throw “No role assigned to $NodeName” }
}
}
}

and here is the configuration file New.psd1:

@{
AllNodes = @(
@{
NodeName = “localhost”
Message = “my message”
Role = “APP”
},
@{
NodeName = “test2”
Message = “my message”
Role = “GW”
}
)
}

In task I provide only:
Machine name (which supposed to be the same as the one in config file so I can match it)
PowerShell Script
Initialization Script

and that’s it when I run it finish successfully but nothing happen !
It only works where I put inside ethe script file rows to kick off DSC script with the path to data file but it beat the purpose of providing file as a parameter in the task…

LiquidDeploy -ConfigurationData C:\Temp\LiquidDrop\Scripts\New.psd1 -OutputPath C:\Temp\OutputPath -Verbose
Start-DscConfiguration -Path C:\Temp\OutputPath -wait –Verbose

I think you need to store the data you have inside your psd1 file as a variable outside of PS, in the Release or Deploy templates. I remember I used to do it in the earlier version of ReleaseManagement that’s now bundled inside TFS 2015 update 2.

haven’t tried it in TFS 2015 yet as I’m still working on upgrades from 2013 and from RM to the new Deploy\Release

Take a look at the approach in the following repo. It is not representing multiple machines but I believe it demonstrates an approach that could meet that requirement.

Generating the config data:

Building the MOF(s) including config data: