PowerCLI

 View Only
  • 1.  Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 11:41 AM

    Hi,

    I am looking for simple script to collect the Orphaned disks in my vcenter.

    where my most of the VMs will have snapshots too, so need to get the report exclude of the snapshot disks.

    i found from LuCD (Orphaned Files Revisited - LucD notes ) it is high advanced.

    so please help me with simple method to collect the information.



  • 2.  RE: Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 11:46 AM

    What is the problem with running that function?

    In the end it's nothing more than calling the function with parameter that indicates the datastore.



  • 3.  RE: Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 12:22 PM

    HI LuCD,

    Yes it shows perfectly, but i was thinking incase if snapshot is present on that VM, will it consider  that VM or not.

    so only, i have decided to create with excluding that.

    in that case, can you please help.



  • 4.  RE: Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 01:14 PM

    The script uses the LayoutEx.File property to get the files that belong to a VM.

    So even if there are multiple snapshots, all the files will be included, and hence not shown in the list of orphaned disks.



  • 5.  RE: Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 01:40 PM

    Thankyou!

    so even if the vm is holding snapshot, report will show only the genuine orphaned disks right?



  • 6.  RE: Find Orphaned Disks and Remove it

    Posted Jul 13, 2018 01:59 PM

    That is correct.

    But as always, make sure you know what you are doing before you start deleting files :smileygrin: