0

I have this snippet of code:

        PowerShell ps = PowerShell.Create();
        var ipAddress = target_ip.Text;
        var padName = pad_name.Text;

        txtLogs.AppendText($"Initializing bootstrapping process for {padName}");
        ps.AddCommand($"knife bootstrap windows winrm.......

This command works find when typing it in normally in the powershell window. When I do this via C#, it says the command isn't recognized. What else do I need to do?

4
  • ps.AddCommand(... -> ps.AddScript(... Commented May 30, 2017 at 16:07
  • Mathias, that looks like what I want. Can you explain the parameters of the AddCommand portion? Is it just "knife" in the add command and the rest in the script portion? Commented May 30, 2017 at 17:36
  • No I'm suggesting you literally replace AddCommand with AddScript Commented May 30, 2017 at 17:38
  • Thanks, it worked! Commented May 30, 2017 at 19:16

0

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.