So I'm using Remove-Item to delete folder with some files within and it works "out-of-the-box" with my current PowerShell/PowerCLI configuration.
Remove-Item -Path "<pathToFolderOnDatastore>\<targetDatastore>" -Recurse
It generates as I believe a task for deleting each file in my vCenter (and that looks a bit scary btw).
However when I browse a datastore directly from that vCenter, tick target folder and hit "DELETE" it generates one task ONLY.
Q: What vCenter uses to delete files/folders from datastore?
Q: What's the best way to remove files from datastore?
Have a look at Solved: Re: Script for Deleting a Folder with its contents... - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
View solution in original post