SharpeRAD / Cake.Powershell

Powershell addin for Cake
http://cakebuild.net
MIT License
83 stars 36 forks source link

Passing a PSCredential #61

Closed rdavisunr closed 6 years ago

rdavisunr commented 6 years ago

I am trying to invoke a script (in a module) that takes a pscredential argument.

As far as I can tell, Cake.Powershell only allows string type args. But, maybe I am missing something. If so, please let me know if there is a way to pass a pscredential...

var someCred  = new PSCredential(username, password.MakeSecure());

 StartPowershellScript("Run-SomeScript", new PowershellSettings()
            .OutputToAppConsole(false)
            .WithModule(moduleFullPath)
            .WithArguments(args =>
                {
                    args.AppendSecret("SomeCredArgument", someCred);
                }));

Thanks!

SharpeRAD commented 6 years ago

Sorry I don't think this will be possible. A simple work around would be to append string arguments to the external script then parse them into a PSCredential inside the Powershell script?