View Only

 VMFX file does not get deleted when deleting from disk and/or using powercli

Jump to Best Answer
ChargeOn's profile image
ChargeOn posted Jun 11, 2024 01:52 PM

Whenever I try to delete a VM or a vApp from vCenter the .vmfx file seems to linger and not get deleted with the VM or vApp. Is there a way that I can have my script delete this file when it deletes the VMs? Thanks

LucD's profile image
LucD Best Answer

It seems the .vmxf filetype, which was first introduced in VMware Workstation, is now used on ESXi as well.
It looks as if that .vmxf file is created when VMware Tools are installed on specific Guest OS.
But the information is scarce, or well hidden.

In  Virtual Machine Files it just states "Additional virtual machine configuration files"

Judging by the content of these .vmxf files, it looks as if they only contain VMware Tools information.

Interesting is this Packer Issue#7140.
It seems their cleanup procedure had an issue with the .vmxf file as well.
The remark from the issue submitter

  • The .vmxf file only appears after VMWare Tools has been installed in Windows and the Windows VM has been rebooted.

seems to confirm the file is VMware Tools related.
And I indeed only see the file on my VMs that run a Windows Guest OS.

But that doesn't solve your original issue.
As another poster previously stated, you could remove that file.
But instead of using a SSH session, use the PowerCLI Datastore provider and the Remove-Item cmdlet.

Rashid Hussain's profile image
Rashid Hussain

We can delete that remaining vmfx file using posh-ssh, but that would not be the right thing to do.

The proper thing would be to find out why that file is not getting deleted, maybe check the log in vCenter and ESXi host. 

btw, is there any content in that leftover file? or it is zero kb in size?

LucD's profile image

A .vmfx file ir primarily used by VMware Workstation.
From the documentation:

This is a supplemental configuration file for virtual machines that are in a team.
Note that the .vmxf file remains if a virtual machine is removed from the team.

You have to remove the Team to get those files removed

ChargeOn's profile image

@LucD That is strange because we do not use VMware Workstation, and I am unfamiliar with what a team would be, is that term used interchangeably with vApp? Can you link the document that you are mentioning. The file size varies depending on the Virtual machine it seems. In my script I have it delete the vApp would there be a way to delete the folder from the datastore with the same name or is there more suggested way to delete virtual machines.