I am trying to build out some simple PowerShell tasks into SIF tasks, and I am really hitting a wall with the simplest stuff. My estimation is that a Command task is for exe and console apps and not PowerShell commands. Example below.
My JSON configuration file dsc.json
{
"Parameters": {
"InstallPath": {
"Type": "Command",
"DefaultValue": "Start-DscConfiguration",
"Description": "DSC Install Path."
}
},
"Tasks": {
"Test-Get-Children": {
"Type": "Command",
"Params": {
"Path": "Get-ChildItem",
"Arguments": [
"-Path",
"*.log"
]
}
},
"Test-DSC": {
"Type": "Command",
"Params": {
"Path": "Start-DscConfiguration",
"Arguments": [
"-Path",
".//Sitecore",
"-Wait",
"-Verbose"
]
}
}
}
}
My Parameters PS1 file.
$configsRoot = Join-Path $PSScriptRoot Configs
$sitecoreDSC = @{
Path = Join-Path $configsRoot dsc.json
}
echo $sitecoreDSC
My install PS1 file
. $PSScriptRoot\parameters.ps1
Install-SitecoreConfiguration @sitecoreDSC
On the Get-Children command my error is this. It seems like it is trying to run the arg on its on command:
Get-ChildItem : Cannot find path 'C:\gh\ScriptTest\PrepServer-Path' because it does not exist. At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.2.1\Public\Tasks\Invoke-CommandTask.ps1:31 char:13 + & $Path $Arguments | Out-Default + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\gh\ScriptTest\PrepServer-Path:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
On the Start-DscConfiguration my error is this. This is because Start-DscConfiguration
was executed with specifying the path. Again, the args were ignored.
Invoke-CommandTask : Cannot convert 'System.Management.Automation.PSObject[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported. At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.2.1\Public\Install-SitecoreConfiguration.ps1:253 char:21 + & $entry.Task.Command @paramSet | Out-Default + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-CommandTask