Quantcast
Channel: VMware Communities : Document List - vSphere PowerCLI
Viewing all articles
Browse latest Browse all 379

Find Orphaned VMDK's

$
0
0

 

 

 

 

(This script is for ESX 3.01, to find snapshots on 3.5 and above change the script en the names it searches for!!!!!)

 

 

 

 

Hi,

 

This script will find all orphaned vmdk's on all your virtual centers (we have more than one ).

 

Our VM's are being administered by mutliple people. When removing a virtual disk, sometimes people forget to delete the vmdk file itself.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This script asks the virtual center what the disk are of each VM and puts this into an array. After this, it reads all files on all datastores. If the file is a vmdk file, it will check wheter this file is in the array. If it's not, you've found a orphaned vmd.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Output is being written to a file.  Script displays the Host off which files are being enumerated(For waiting purposes).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Variables whcih have to be submitted:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$arrayVC = "YourVirtualCenter"

$OutputFile = "C:\OrphanedVMDK.txt"

                                                                                Greetings,

 

 

 

 

 

 

Ad van Bokhoven

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This document was generated from the following thread: Find Orphaned VMDK's

 

 


Viewing all articles
Browse latest Browse all 379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>