So this will work just fine but as soon as I add "Out-Host" whilst the script still runs and the output is displayed to the console, the "if" part occurs causing my own error message to show. Please note I'm only temporarily using write-host until I can get write-output working.
Powershell
functionscripts{$arrScripts=getArrScriptsforeach($itemin$arrScripts){$scriptPath="$letter\Testing\Scripts\2ndScripts\$item"if(!(Powershell.exe$scriptPath|Out-Host)){$errorMessage="2nd Scripts: $item cannot be executed"pauseScript$errorMessage}else{Write-Host"$tab 2nd Scripts: Starting $item"|Add-Content$outLogPath-ErrorActionSilentlyContinue}}}