Hi LucD,
After our discussion, I need to update the attached script that finds all the ESX Orphaned Files
You wrote the script to find only the Orphaned Files within the Data-stores without deleting them
Can you provide an updated Script that Find all the Orphaned Files and Give the user the -Delete Option ?
Something like this : Orphaned files and folders - Spring cleaning - LucD notes
Thanks in Advance
Try with the attached new version.
You can now do
Get-Datastore -Name DS1 | Get-VmwOrphan -Delete -WhatIf
Once you are sure the correct files will be removed, you can drop the WhatIf switch.
I added an additional parameter ExcludeFolder, which is jandy if you to want speficic folders on the datastore (ISO folder, snapshot folder...)
You can use it like
Get-Datastore -Name DS1 | Get-VmwOrphan -ExcludeFolder 'Folder1','Folder2'
And finally a PS, sometimes you will need to call the function at least twice.
When an orphaned folder contains and orphaned file, the 1st run will remove the file, the 2nd run will remove the folder.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you a lot,
I will check the script and update you with the results as soon as possible
LucD,
I read through the comments in your spring cleaning script. I admit it, I got lost when it came to altering the script for an NFS environment.
Do you have a copy of your script that returns results for an NFS environment?
It should be just changing
if($ds.Type -eq "VMFS" -and $ds.ExtensionData.Summary.MultipleHostAccess){
into
if($ds.ExtensionData.Summary.MultipleHostAccess){
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference