test-path returns permission denied – how to do error handling

Question:

i try to do error handling within my powershell script. but i always get an fatal. i tried a few things, e. g. try{ } catch{ } – but i did it not get to work.

any ideas or Solutions?

It Returns:

Answer:

Somewhat confusingly Test-Path actually generates an error in a number of cases. Set the standard ErrorAction parameter to SilentlyContinue to ignore it.

Source:

test-path returns permission denied – how to do error handling by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply