How can I empty the recycle bin for all users from a Windows service application in c#,
I’m looking for a c# snippet which I can insert in a Windows service. The code must empty the recycle bin for all users on the computer.
I have previously tried using
SHEmptyRecycleBin (ref however the code doesn’t work when ran from a windows service as the service is running with local system privileges.
Hopefully you can’t.
A service running as the local machine should not be clearing my Recycle bin, ever.
You could promote the service to run as an Admin account then it would have the right (and be a security risk), but why do you want to do this? It sounds like the sort of think Viruses try to do.
That’s the answer How can I empty the recycle bin for all users from a Windows service application in c#, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.
The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you