There are several types of in-use storage that can be reclaimed.
For orphaned files, you can use my Orphaned Files And Folders – Spring Cleaning post and add the -Delete switch.
But only after you have run the function without the -Delete switch and verified the resulting report!
For snapshots, again after verification, it is quite straightforward.
Get-VM | Get-Snapshot | Remove-Snapshot -Confirm:$false
What other kinds of in-use storage did you have in mind?Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
if you dont mind, i did try to clean up an orphaned file using the attached script, but it always generate the Zombie file report instead of deleting the Orphaned/Zombie file. It would be nice if you can help me to fix the script for Zombie or Orphaned file cleanup. It always generate the report but never deleted when i compare with Rv tools report.
You have to use the -Delete switch when you actually want to remove the files and folders.
But make sure to check the report, from a run without the -Delete switch, first!Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Thank you LucD.
you mean Remove-OrphanedData should be replaced by -Delete
No, that last line should look like thisGet-Datastore * | Remove-OrphanedData -Delete |
Export-Csv D:\DC_Zombie.csv -NoTypeInformation –UseCulture
But make absolutely sure that you know what you are doing.Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Thank you LucD. First, i need to run and test in a smaller environment. Will verify later.