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