Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

How to get return value of Invoke-Expression in Powershell

$
0
0

So this is my code

$result = Invoke-Command -Session $session -FilePath $ps1

How do I get the result given by $ps1?

The code of that function is supposed to give a true false result like in the following:

function MyFunction{#some codeif ($JobStatus -like "Running")        {        $result = $false            Write-Host "Gresit" -foreground Red        }    else         {        $result = $true            Write-Host "Corect" -foreground Green        }return $result}

I added this command and unfortunately I have red output

if ( $result -eq $null ) { write-host "Result: $result" -foreground Red } 

Viewing all articles
Browse latest Browse all 207

Trending Articles



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