Click here to Skip to main content
15,888,109 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi all

below is the code i am trying to delete content in recycle bin. but after executing also it's not deleting the files

Please let me know whats the issue.

I am running the code at windows server 2012 R2 64-bit.

What I have tried:

$Shell = New-Object -ComObject Shell.Application
$RecBin = $Shell.Namespace(0xA)
$RecBin.Items() | %{Remove-Item $_.Path -Recurse -Confirm:$false}
Posted
Updated 23-May-16 2:34am

1 solution

There is a lot of information and code samples on this topic. See, for example, PowerShell Function Clear-RecycleBin[^].

See also: Empty recycle bin using PowerShell [^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900