Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PowerShell Workflow: Returning $PSCredential from function

$
0
0

Greetings All,

When using PowerShell Workflows, I have a function which returns a $PSCredential object, and workflow code that assigns the return to a variable.  The function call enters and exits wonderfully with just about any other value, primitive or complex type, but the minute you try to return something of type PSCredential, the workflow hangs indefinitely.  See below for example.  Thoughts?

workflow wf {
function f1 {return "Value from f1"}
function f2 {return (New-Object [PSCredential]("User","Password"))}

$f1Return = f1
Write-Output $f1Return

#Code will not get past the next line.  Workflow hangs.
$f2Return = f2
Write-Output $f2Return
}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>