Command For Undo — Windows

function Undo-LastDelete <# .SYNOPSIS Restores files from Recycle Bin (undo for del/Remove-Item) .EXAMPLE Undo-LastDelete -Last 5 #> param([int]$Last = 1) Add-Type -AssemblyName Microsoft.VisualBasic $shell = New-Object -ComObject Shell.Application $recycleBin = $shell.NameSpace(0x0a)