1. Please check if WinRM with CredSSP is working.
Invoke-Command -ComputerName $headnode -ScriptBlock { ping 127.0.0.1 -n 5} -Authentication CredSSP -Credential $instcred
2. Please make sure SQL express has been already installed before running "setup.exe -unattend -headnode". I saw issues when installing SQL remotely.
$command = $setupfilepath+"\setup.exe -headnode -unattend";
Invoke-Command -ComputerName $headnode -ScriptBlock { param($command) cmd /c $command } -ArgumentList $command -Authentication CredSSP -Credential $instcred
3. If you have remote database, please try below commands.
$dbparams = "blabla";
$command = $setupfilepath+"\setup.exe -headnode -unattend " + $dbparams;
Invoke-Command -ComputerName $headnode -ScriptBlock { param($command) cmd /c $command } -ArgumentList $command -Authentication CredSSP -Credential $instcred
BR, Yizhong