PowerShell codebase misuses SHEmptyRecycleBin function in Clear-RecycleBin cmdlet

Clear-RecycleBin is a cmdlet that clears your recycle bin. Internally, it calls SHEmptyRecycleBin function. It has been malfunctioning for a long time: when you run the cmdlet for the first time in a PowerShell session with Force switch on, it produces an ErrorRecord. Further investigation shows that it is detecting error status of SHEmptyRecycleBin the wrong way. To make things worse, SHEmptyRecycleBin is really bad at error handling.

文章来源:

Author:Gee Law’s Blog
link:https://geelaw.blog/entries/clear-recyclebin-shemptyrecyclebin/?utm_source=feed&utm_medium=rss