Is there a way to get only an error message when displaying error descriptions when running a script?
I have a script that runs, and when an error occurs, I get error messages at different times, for example, if I do not pass the parameter to the function that I wrote, I will get:
No Setup Location specified (i.e. \\server\share\folder)
At \\server\share\folder\script.ps1:9 char:31
+ [string] $setupHome = $(throw <<<< "No Setup Location specified (i.e. \\server\share\folder)")
+ CategoryInfo : OperationStopped: (No Setup Locati...ojects\something):String) [], RuntimeException
+ FullyQualifiedErrorId : No Setup Location specified (i.e. \\server\share\folder)
This is good, but I would like to set a preference (for example, ErrorAction), which will show me an error message, and not all the extra cream that is nice to have but clutters up my console. Therefore, instead of the foregoing, I would like to see only the first line:
No Setup Location specified (i.e. \\server\share\folder)
source
share