VMware Shared Folders

When Microsoft Windows systems are virtualized with VMware ESX or Workstation, WMware Tools is installed. When the VMware tools are installed with the Complete option, the shared folders option is enabled. This feature is not enabled when you install VMware tools with the Typical option.

The shared folder feature is not supported by ESX or GSX server and causes problems on Terminal Servers. The file hgfs.dat is opened by the VMware Tools with exclusive acces, which prevents the profile from getting deleted.


In a terminal server environment is common to use roaming (or mandatory) profiles. To prevent the system from bloating with unused profiles, the profiles are usually removed at logoff. Since the hgfs.dat is locked, this is prevented and the server might end up with many profile folders.

Documents and Settings

Local Settings - Application Data - VMware - hgfs.dat


Event Log

In the event log the following events can be found.

Event ID	1533
Source	User Profile Service
Type	Error
Description	Windows cannot delete the profile directory C:\Users\\AppData\Local\VMware\hgfs.dat. This error may be caused by files in this directory being used by another program. 

	DETAIL - The directory is not empty.
Event ID	1000
Source	Userenv
Type	Warning
Description	Windows cannot copy file C:\Users\\AppData\Local\VMware\hgfs.dat to . Contact your network administrator.

	DETAIL - The process cannot access the file because it is being used by another process.



The problem can be solved by disabling the Shared Folder feature in VMware Tools. This has to be configured in the registry by removing the shared folder feature from the NetworkProvider.

From VMware KB article 1317:

  1. Access the Windows Registry. Choose Start > Run, then type regedit. The Registry Editor window opens.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order\.
  3. Right-click ProviderOrder and choose Modify. In the Edit String Value dialog box, edit the value data string and remove the word hgfs, vmhgs, or vmhgfs).
    • If the value data string contains LanmanWorkstation,hgfs, LanmanWorkstation,vmhgs, or LanmanWorkstation,vmhgfs, change it to LanmanWorkstation.
    • If the value data string contains only hgfs or vmhgfs, erase it and leave the value data string empty.
  4. Click OK.
  5. Close the registry editor. Choose File > Exit.
  6. Reboot the virtual machine.

Network Provider Order - Before

Network Provider Order - Edit

Network Provider Order - After

Instead of editing the value per server I created a small VBscript to deploy on all Terminal Servers.

'Define variables
   Dim objShell
   Dim strProviderOrder

'Connect to subssystems
   Set objShell = WScript.CreateObject("WScript.Shell")

'Read registry key
   strProviderOrder = objShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order\ProviderOrder")

'Remove VMware Shared Folder
   strProviderOrder = Replace(strProviderOrder, "vmhgfs,", "", 1, -1, 1)
   strProviderOrder = Replace(strProviderOrder, "vmhgs,", "", 1, -1, 1)
   strProviderOrder = Replace(strProviderOrder, "hgfs,", "", 1, -1, 1)

'Write registry key
   objShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order\ProviderOrder", strProviderOrder, "REG_SZ"

6 Reacties

  1. Thanks for the article. Fixed my issue Citrix XenApp servers. I found a CTX related article that mentions to go to add/remove programs and modify the vmware tools installation by unchecking vmware shared folders. VMware tools cannot be modified/change on my servers. Your fix helped as a work around.

  2. I made the change Provider Order now = SnacNp,PICAClientNetwork,RDPNP,LanmanWorkstation,webclient,PnSson

    However, I’m still getting Profile Bloating. Any other suggestions?

    1. Are your profiles bloating or aren’t they removed after users logoff? These are two complete different problems (with different solutions).

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.