I came across several documents on how to run a Powershell script within Jenkins pipeline and how to capture output. However I want to use the captured output for next node powershell script. e.g.
node {
def msg = powershell(returnStdout: true, script: 'Write-Output "PowerShell is mighty!"')
}
Now I want to use msg in the next node within Powershell script. Like if we can assign it to a powershell variable and then perform operations with that variable.
Any pointers on how this can be achieved?