Source
- use
-ErrorAction Ignore
(return code will be success), or-ErrorAction SilentlyContinue
(return code will be failure, but not error be raised)
Remove-Item <Path> -ErrorAction Ignore
Source
-ErrorAction Ignore
(return code will be success), or -ErrorAction SilentlyContinue
(return code will be failure, but not error be raised)Remove-Item <Path> -ErrorAction Ignore