I am trying to execute following test.ps1
script
param([string]$name,[string]$password);
write-Output "Hello $($name) my password is $($password)";
dir c:\
New-Item c:\HRTemp\test.txt -ItemType file
on remote server using following command
StartPowershellScript("Invoke-Command", args =>
{
args.Append("ScriptBlock", "{{c:\\test.ps1 -name dato -password test}}" );
});
I was able to successfully invoke this command from command line and now I want the same using 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 am getting error:
Error: Input string was not in a correct format.
When I try it with two curly brace
{{c:\\test.ps1 -name dato -password test}}
output is the following
Executing: Invoke-Command -ScriptBlock {{c:\test.ps1 -name dato -password test}}
but, when I check on remote server test.txt file is not created.
Do you have any ideas why this is happening?