Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Out-Host breaking things

$
0
0

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}}}

Viewing all articles
Browse latest Browse all 15370

Trending Articles



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