0

i've created a c# windows form that running multiple PowerShell commands, and I have issue with one if the command PowerShell command:

Set-CalendarProcessing -Identity "email" -AddAdditionalResponse:$true -AdditionalResponse:"message" 

How I run it from C#:

myCommand = new Command("Set-CalendarProcessing");
            myCommand.Parameters.Add("identity", desiredRoom);
            myCommand.Parameters.Add("AddAdditionalResponse", "true");
            myCommand.Parameters.Add("AdditionalResponse", message);
            plPileLine = rsRemoteRunspace.CreatePipeline();
            plPileLine.Commands.Add(myCommand);
            RsResultsresults = plPileLine.Invoke();

I'm getting error that 'true' passed as a string and powershell isn't converting to bool, I tried '$True', '1', none of them worked, please advice. thank you.

1
  • Have you tried to pass it as plain bool without quotes? Commented Aug 21, 2018 at 5:11

1 Answer 1

2

I'm pretty sure true is a keyword in C#. It seems obvious, but it's worth asking if you tried:

myCommand.Parameters.Add("AddAdditionalResponse", true);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.