I am trying to execute the following test.ps1script
param([string]$name,[string]$password);
write-Output "Hello $($name) my password is $($password)";
dir c:\
New-Item c:\HRTemp\test.txt -ItemType file
on the remote server using the following command
StartPowershellScript("Invoke-Command", args =>
{
args.Append("ScriptBlock", "{{c:\\test.ps1 -name dato -password test}}" );
});
I managed to successfully call this command from the command line, and now I want to use the same with a cake script.
I am using Cake.Powershell addin.
When I try to execute it with one curly brace {c:\\test.ps1 -name dato -password test}, I get an error message:
Error: Input string was not in a correct format.
When I try to use two curly braces
{{c:\\test.ps1 -name dato -password test}}
the conclusion is as follows
Executing: Invoke-Command -ScriptBlock {{c:\test.ps1 -name dato -password test}}
but when I check on the remote server, the test.txt file is not created.
Do you have any idea why this is happening?