Hey all,
I am not sure if what I am looking for is possible or not as I am not the best at scripting but I am needing a script that will search through and find any .vmdk files with a -000000*.vmdk format. You know that snapshots can creep around and not show up in the snapshot manager and just create vmdk files with that format and this would be great to help out with those rogue snaps.
If any one has another way to do this I am all ears.
Andy
You're asking for a script, and I'm sure you'll soon get a response how to do this.
Anyway since you are also asking for other ways to find out about snapshots, I recommend you take a look at RVTools which is a great free tool. In addition to other information, it provides a "vSnapshot" tab where it shows all VMs with active snapshots.
André
Since you seem to be looking for orphaned VMDK files, I would suggest you take a look at my Orphaned files and folders – Spring cleaning post.
From the resulting files you can easily extract the orphaned snapshots.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Would this only report old vmdk files left around? Because that would be helpful, but I am looking for active VMs with rogue snapshots running outside of the snapshot manager with the -0000X.vmdk formats.
The script looks skips all active files for a VM, so it should report the ones that are orphaned.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok I think we are getting some target goals confused. Sounds like you are hunting for vmdks that are no longer in use by a VM at all. That is a great idea too, but I am hunting for ANY .vmdk that has the format VM-NAME-00000#.vmdk that means it is a snapshot. I need this because sometimes these snapshots do not show inside the snapshot manager and need to be removed.
My script finds all VMDKs that are not actively connected to a VM anymore.
Those include your VM-NAME-00000#.vmdk files.
It's just a matter of extracting from all the orphaned files, the ones that you want
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
But my snapshot vmdk files are actively connected to a VM so they don't show up in your script. They are not orphaned but being used but not reporting to the snapshot manager.
That is strange, if the snapshots do not show up in the Snapshot Manager, they don't feature in the VM's file list, and hence should turn up as orphaned files.
I would be interested to see this layout.
You could my UML mapper if you know one such VM. See UML diagram your VM, vdisks and snapshots
If what you are saying is correct, then these files should show in the UML diagram, but not in the Get-Snapshot cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I dug around and found the script needed for this: https://shareSync.serverdata.net/web/s/JzjbNuk_geCTbr99UHPeno
Only problem is I would like to have it skip any VM with a _replica suffix.
Replace line 87 in the script with below to ignore VMs with name '_replica'.
$vmlist = Get-VM -Server $ESXserver | where { $_.Name -notmatch "_replica" } | Sort