How to Fetch the Output from Powershell Script and Convert it to String

The issue seems big but the solution is simple. First, when you try to run the script to store it as a string, you get the following error:

‘Check Outlook Failed.’

‘Object reference not set to an instance of an object.’

In order to run the powershell script and bring the output into a string variable, you need to do the following:

 Use “Run power shell script” only and no other PowerShell.

It will work fine with the following script:

$ProcessActive = Get-Process outlook -ErrorAction SilentlyContinue

if ($ProcessActive -eq $null) {

return $a = “False”

} else {

return $a = “True”