Avatar of rakkad
rakkad
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Powershell running within a DOS batch script to include error handling

Hi

I have the following powershell script which is called within a DOS batch:-

@ECHO ON
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"

I need to include error conditions in the script, if the script fails and logs these entries to a log file or eventviewer please ?

Thanks
PowershellMicrosoft DOS

Avatar of undefined
Last Comment
Coralon

8/22/2022 - Mon