PowerShell - script 1 calls script 2 - how to return value from script 2 to script 1
I have two PowerShell scripts. One script invokes another PowerShell script using elevated credentials, using Start-Process . But I am struggling with how to make the second script return the output value to the first script. Here is script # 1, which is invoked with script1.psl "sender-ip=10.10.10.10" function getUser($abc) { <#Previously created password file in C:\Script\cred.txt, read-host -assecurestring | convertfrom-securestring | out-file C:\Script\cred.txt#> $password = get-content C:\Script\cred.txt| convertto-securestring $credentials = new-object -typename System.Management